获取“numpy.int64”对象不可调用并且“张量之间的大小不匹配”构建 MLP 时 PyTorch 中的错误
我有 4 个文本文件,其中一个包含 x1
、x2
、x3
作为训练特征,另一个是 y 作为标签,相同适用于测试。
我必须在 Pytorch 中构建多层感知器(MLP)模型 我所做的是将这些文本文件加载到 PyTorch,名称为 x_train
、y_train
、x_test
和 y_test
.
但是,当我运行下面的代码时:
dataset_train = data.TensorDataset(x_train,y_train)
dataloader_train =data.DataLoader(dataset_train, batch_size=10, shuffle=True,num_workers=0)
我收到此错误:
'numpy.int64' object is not callable
我还看到:张量之间的大小不匹配
。
请帮我解决这个错误,它是什么意思以及我必须更改什么?
I have 4 text files,one of which includes x1
,x2
,x3
as training features and the other one is y for labels and the same applies to testing.
I have to construct a Multi Layer Perceptron (MLP) model in Pytorch
and what I did was to load these text files to PyTorch under the names of x_train
,y_train
,x_test
and y_test
.
However when I run the code below:
dataset_train = data.TensorDataset(x_train,y_train)
dataloader_train =data.DataLoader(dataset_train, batch_size=10, shuffle=True,num_workers=0)
I get this error :
'numpy.int64' object is not callable
I also see this : Size mismatch between tensors
.
please help me with this error,what does it mean and what I have to change ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论