Pytorch-IndexError: too many indices for tensor of dimension 0
在采用pytorch进行CNN实现了,遇到了如下的问题:
IndexError: 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([transforms.Grayscale(num_output_channels=1),transforms.ToTensor(),transforms.Normalize((0.5),(0.5,)),
)
具体的问题在于:
transforms.Normalize((0.5),(0.5,)),
需要在第一个0.5后面加上逗号。
问题分析:
可能是pytorch版本导致的。
将代码改为:
transforms.Normalize((0.5,),(0.5,)),
问题解决~
Pytorch-IndexError: too many indices for tensor of dimension 0相关推荐
- pytorch中IndexError: too many indices for tensor of dimension 0问题解释
链接http://main.net.cn/faq/big-data-ai/ai/pytorch/pytorch-dataloader-indexerror-too-many-indices-for-t ...
- too many indices for tensor of dimension 3
too many indices for tensor of dimension 3 原因还未找到,只是感觉把维度换成一模一样就不报错了,或者换成另一片博文中的也可以. too many indice ...
- pytorch小知识点(三)-------Tensor的indices操作
一.Tesnor 先简单介绍一下Tensor.Tensor是pytorch的核心,它是一个包含单一数据类型的多维矩阵. pyTorch定义了七种CPU tensor类型和八种GPU tensor类型: ...
- Tensorflow图像通道合并,IndexError: too many indices for array
在读入多张图像并且在第3维上进行合并时(image[:, :, :]),出现IndexError: too many indices for array错误 data1 = imread('E:/da ...
- 报错:IndexError: too many indices for array
在使用ribodiff进行TE分析的时候,出现下方报错: Traceback (most recent call last):File ".\TE.py", line 81, in ...
- pytorch一行实现:计算同一tensor矩阵内每行之间的余弦相似度
文章目录 0 输入数据 1 余弦相似度(Cosine Similarity) 2 torch.cosine_similarity 3 问题 4 分析与解决 4.1 答案 5 另外的实现方法 0 输入数 ...
- Cannot input a tensor of dimension other than 0 as a scalar argument
Cannot input a tensor of dimension other than 0 as a scalar argument 错误代码: channels_per_group = num_ ...
- IndexError:boolean index did not match indexed array along dimension 0
转自:https://blog.csdn.net/pcy1127918/article/details/79975152 IndexError: boolean index did not match ...
- Pytorch踩坑: RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0.
报错信息: RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 186 a ...
最新文章
- 数据库设计性能与效率
- 为什么自动化对于IT工程师是必须的?
- go语言笔记——多值函数,本质上和nodejs的回调很像,不过nodejs是回调的第一个参数是err,而golang里是第二个!...
- 关于kafka中的timestamp与offset的对应关系
- JDBC--Java Database Connectivity
- canvas笔记-使用canvas画圆及点阵的使用
- MyBatis复习(五):获取多表关联查询结果
- 移动应用占美国人移动设备使用时长80%
- PingingLab传世经典系列《CCNA完全配置宝典》-2.9 OSPF基本配置
- AI为移动医疗APP加码,智能提醒你:该吃药了!
- html制作省市区三级联动,js实现省市区三级联动
- 正运动技术 运动控制卡应用开发教程之C#
- 刀塔自走棋无限寻找服务器怎么办,刀塔自走棋无法连接服务器怎么办_刀塔自走棋无法连接服务器解决办法_玩游戏网...
- html图像缩小失真,图像放大和缩小不失真的方法!
- 使用curl控制下载速度
- C语言strcpy()库函数的实现
- 麦克风有突突突的杂音
- minicom - 友好易用的串口通信程序
- 安卓逆向学习笔记(一)
- 校招linux基础知识,校招笔试整理 牛客网 2020小米校招(1)
热门文章
- 逻辑斯蒂 (阻滞增长) 模型的分析和应用
- C语言改变变量指定位置值
- 计算机科学与技术考研数学一的内容,计算机科学与技术考研考哪些科目 备考技巧有哪些...
- word怎么插入长分页符
- SWEBOK软件工程知识体系 - 10.软件质量
- 0001_halcon-测量函数说明
- Android rom开发:长按Power键关机/重启优化,告别长时间等待
- postgresql源码学习(九)—— 常规锁②-强弱锁与Fast Path
- 信用卡年轻消费群体数据分析和洞察报告
- python-----DataFrame.style (三、切片)