社区
Java
帖子详情
IndexError: too many indices for tensor of dimension 1(10rmb)
鱼雨羽
2020-06-26 07:26:10
解决给10rmb,任何方式都行。python问题如下:
...全文
4595
3
打赏
收藏
IndexError: too many indices for tensor of dimension 1(10rmb)
解决给10rmb,任何方式都行。python问题如下:
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
maggiehhh
2020-08-03
打赏
举报
回复
masks[:,lengthsmax] 试试这样
鱼雨羽
2020-07-05
打赏
举报
回复
不对啊。我运行还是报错,麻烦你看一下,谢谢
sh_c_1314
2020-06-26
打赏
举报
回复
看报错masks是一维的,你好像使用了2维索引, 试试masks[:lengthsmax]
解决
Index
Error
: too many
indices
for
tensor
of
dimension
3
如果不小心搞错了
tensor
的维度,就会出现以下错误 >
Index
Error
: too many
indices
for
tensor
of
dimension
3 很有可能是你是一个三维的
tensor
,但是你在调用索引时使用了第四维的索引作切片, 这时应该检查是不是因为粗心而导致
tensor
的维度出错 例如: x = torch.randn(1, 2, 3) x[0, 0, 0, 0] 这样就会报
Index
Error
: too many
indices
for
tensor
of dimen
Index
Error
: too many
indices
for
tensor
of
dimension
1 框架中复杂代码环境
1. 尝试 print(wire_post_side),注意:不要 print(wire_post_side[:, :4]),是 取二维
tensor
的前四列 会报错。当
tensor
为空时,其
dimension
小于2,出现了同样的错误:
Index
Error
: too many
indices
for
tensor
of
dimension
1。表明变量wire_post_side的
dimension
小于2。在代码环境中,该行反复运行,输入变量wire_post_side的值不断变化。运行代码中出现如下错误。
Pytorch-
Index
Error
: too many
indices
for
tensor
of
dimension
0
在采用pytorch进行CNN实现了,遇到了如下的问题:
Index
Error
: too many
indices
for
tensor
of
dimension
0 具体代码如下: JitterTest_Dataset = JitterDataset( csv_file= './jitter_labels/new_jitter_test.CSV', root_dir= './Test_jitter_Square/', transform= transforms.Compose([
成功解决在目标跟踪时检测不到物体:
Index
Error
: too many
indices
for
tensor
of
dimension
1
解决:
Index
Error
: too many
indices
for
tensor
of
dimension
1 在使用Yolov5+DeepSort目标跟踪代码时,开发qt界面调用摄像头,
:too many
indices
for
tensor
of
dimension
3
然而,当我们尝试使用维度为3的张量进行操作时,有时会遇到"too many
indices
for
tensor
of
dimension
3"(维度为3的张量有太多的索引)的错误信息。最后,打印输出的张量形状,以验证代码的正确性。当出现"too many
indices
for
tensor
of
dimension
3"错误时,我们需要检查代码中涉及该错误的部分,并确保使用的索引数量与张量的维度相匹配。我们可以使用适当的函数或方法来获取张量的维度信息,并与我们预期的维度进行比较,从而确保维度的一致性。
Java
50,527
社区成员
85,606
社区内容
发帖
与我相关
我的任务
Java
Java相关技术讨论
复制链接
扫一扫
分享
社区描述
Java相关技术讨论
java
spring boot
spring cloud
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章