小编fee*_*_pi的帖子

IndexError:用作索引的张量必须是 long、byte 或 bool 张量

我仅在测试阶段遇到此错误,但在训练和验证阶段没有遇到任何问题。

IndexError: tensors used as indices must be long, byte or bool tensors
Run Code Online (Sandbox Code Playgroud)

我在给定代码片段的最后一行收到此错误。

代码片段如下所示,

IndexError: tensors used as indices must be long, byte or bool tensors
Run Code Online (Sandbox Code Playgroud)

“lab”是一个张量值,并以这种方式打印出范围,

tensor([6, 7, 8])
tensor([ 9, 10, 11])
tensor([21, 22, 23])
Run Code Online (Sandbox Code Playgroud)

(注*:根据 ElementsPerClass 的值,该实验张量的长度可以是长度“n”)

python image list deep-learning pytorch

4
推荐指数
1
解决办法
3万
查看次数

标签 统计

deep-learning ×1

image ×1

list ×1

python ×1

pytorch ×1