Getting TypeError: 'int' object is not callable on creating dataset

I am trying to train a timeseries model with X_train shape =(-1, length, features), y_train shape=(-1)
But I am getting error on creating the dataset out of it. Below is my code

X_train = load(open(r"X_train_"+str(dataset_idx)+"_"+str(model_idx)+".pkl", 'rb'))
y_train = load(open(r"y_train_"+str(dataset_idx)+"_"+str(model_idx)+".pkl", 'rb'))

print(X_train.shape, y_train.shape)

dataset_train = torch.utils.data.TensorDataset(X_train, y_train)

Below is output:

(3654, 20, 4) (3654,)

Traceback (most recent call last):

File ~\anaconda3\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
exec(code, globals, locals)

File d:\scripts\pytorch.py:206
main(model_idx, dataset_idx)

File d:\scripts\pytorch.py:176 in main
dataset_train = torch.utils.data.TensorDataset(X_train, y_train)

File ~\anaconda3\lib\site-packages\torch\utils\data\dataset.py:189 in init
assert all(tensors[0].size(0) == tensor.size(0) for tensor in tensors), “Size mismatch between tensors”

File ~\anaconda3\lib\site-packages\torch\utils\data\dataset.py:189 in
assert all(tensors[0].size(0) == tensor.size(0) for tensor in tensors), “Size mismatch between tensors”

TypeError: ‘int’ object is not callable

Can someone please let me know what I am missing here.
Thanks

I guess you are passing numpy arrays to your TensorDataset instead of tensors:

a = np.random.randn(10)
a.size(0)
# TypeError: 'int' object is not callable
a.size
# 10

x = torch.randn(10)
x.size(0)
# 10

which will then raise the error since size is an attribute for numpy arrays and a method for tensors.