Pytorch自定义数据集具有多种返回数据类型。

huangapple go评论49阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年2月6日 16:51:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/75359108.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定