In_features and out_features do not accept numpy.int64


(Gabriel Maliakal) #1

Hi,

Before the update, I could pass numpy.int64 as inputs to determine the size of nn.Linear weights, but now it does not accept it instead it only accepts ints. I was wondering why this was done and does this speed things up more ?


(Trevor Killeen) #2

Can you provide a code snippet that triggers this error?


(Gabriel Maliakal) #3

Sure,

import numpy as np
import torch.nn as nn

arr = np.arange(1,10)

layer = nn.Linear(arr[-1],arr[5])

Error, expected (int,…) didn’t match because some of the arguments have invalid types :(numpy.int64,numpy.int64) torch.FloatTensor viewed_tensor …


(Trevor Killeen) #4

What version of PyTorch were you using before? This does not work on v.0.1.12 also.


(Gabriel Maliakal) #5

Oh okay, I had not updated PyTorch from a long time. It must have been 0.1.11 or 0.1.10