RuntimeError: Caught RuntimeError in DataLoader worker process 2. RuntimeError: result type Float can’t be cast to the desired output type Long.
我这边遇到的问题是进行多线程训练的时候出现的问题dataloader = data.DataLoader(dataset, batch_size=batch_size, shuffle=True, num_workers=num_workers, pin_memory=True)。网上找了各种办法试了,也不管用,跑几个epoch就停了,包括torch.multiprocessing.set_start_method(‘spawn’)。最后发现需要将数据增强得到的label转换成float格式,即
image_data, label_data = self.transforms(image, target)
label_data = label_data.float()
RuntimeError: Caught RuntimeError in DataLoader worker process 2.
最新推荐文章于 2024-10-10 22:34:01 发布