In_features and out_features do not accept numpy.int64


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 ?

Can you provide a code snippet that triggers this error?


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 …

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

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