英文:
Pytorch Custom Dataset with multiple return datatypes
问题
在__getitem__()
函数中,你可以选择分别返回每个元素,如 return int, list, bool
,或者将它们打包成一个元组返回,如 return (int, list, bool)
。
英文:
I am writing a custom torch Dataset for my problem. For each sample, I would like to return an integer, a list of 10 floats and a boolean. What is the most efficient way to deal with this?
So in the __getitem__()
function should I return each element separately like return int, list, bool
or for example packed in a tuple return (int, list, bool)
?
答案1
得分: 1
返回 "separately" 将默认返回一个 元组。
英文:
Returning "separately" will default to returning a tuple.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论