问题描述
我正在 PyTorch
中从 DataSet
制作一个 DataLoader
.
I am making a DataLoader
from DataSet
in PyTorch
.
从加载所有 dtype 作为 DataFrame
开始代码>np.float64
Start from loading the DataFrame
with all dtype as an np.float64
result = pd.read_csv('dummy.csv', header=0, dtype=DTYPE_CLEANED_DF)
这是我的数据集类.
准备train_loader和test_loader
这是我的 csv
文件
当我尝试迭代 train_loader
时.它引发了错误
When I try to iterate over the train_loader
. It raises the error
相关问题:
https://github.com/pytorch/pytorch/issues/10165
https://github.com/pytorch/pytorch/pull/9237
https://github.com/pandas-dev/pandas/issues/21946
问题:
如何在此处解决 pandas
问题?
推荐答案
参考:
https://github.com/pytorch/pytorch/issues/9211
只需将 .tolist()
添加到 indices
行.
Just add .tolist()
to indices
line.
这篇关于TypeError:“numpy.int64"类型的对象没有 len()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!