Based on the error message it seems that you are using a np.array instead of a tensor, as the former returns an int from the .size attribute:
x = np.random.randn(10)
x.size()
> TypeError: 'int' object is not callable

x = torch.randn(10)
x.size()
> torch.Size([10])

so you might want to use tensors.