在使用pytorch进行数据加载的时候,出现以下错误:
for i,sample in enumerate(train_loader):
return self._process_next_batch(batch)
raise batch.exc_type(batch.exc_msg)
samples = collate_fn([dataset[i] for i in batch_indices])
samples = collate_fn([dataset[i] for i in batch_indices])
**NotImplementedError**
批量加载数据的过程中出现错误。
检查发现是数据处理的过程中出现错误,在将数据进行封装的过程发生了由于函数书写错误导致。
def __getitem_(self, idx):
if self.label is None: return self.data[idx]
return self.data[idx], self.label[idx]
下划线少写了一个,修改完成之后没有问题。