当我做loss backward的时候,遇到这个问题。

先是查到,这个问题可以通过autograd.variable解决,我将最后得到loss的中间变量加上之后觉得无法利用之前的信息
手写双线性插值也并不能解决这个问题
在pytorch社区发现类似问题,有人提出,不用index,而是用 gather, index_put_ , masked_scatter_  or grid_sample ,给我提供了解决方法。
https://discuss.pytorch.org/t/leaf-variable-moved-into-graph-interior/17489/5
有了整体方向,接下来一个比较大的问题,就是我发现这些函数都是针对某行或者某列操作,交叉用的话,还是需要提取最后得到的矩阵的对角线的值,还没无法避免取[index]的过程。
解决方法是,用.view(-1)将矩阵拉平,再找对应的值。
后面还涉及到我以为torch.cat没法把我的两个行向量组成一个两行的矩阵,最后发现是需要用unsqueeze进行维度扩展等等,不过都是小问题,卡的时间不久。

argument 'indices' must be tuple of Tensors, not Tensor相关推荐

  1. pytorch view(): argument 'size' (position 1) must be tuple of ints, not Tensor

    view(): argument 'size' (position 1) must be tuple of ints, not Tensor pytorch的view函数参数不能是tensor,解决方 ...

  2. 成功解决TypeError: __init__() got an unexpected keyword argument 'indices'

    成功解决TypeError: __init__() got an unexpected keyword argument 'indices' 目录 解决问题 解决思路 解决方法 解决问题 TypeEr ...

  3. ValueError: List argument ‘indices‘ to ‘Sparse Concat‘ Op with length 0 shorter than minimum length2

    错误ValueError: List argument 'indices' to 'Sparse Concat' Op with length 0 shorter than minimum lengt ...

  4. Tracer cannot set value trace for type None. Supported types are tensor, tensor list, and tuple

    Tracer cannot set value trace for type None. Supported types are tensor, tensor list, and tuple of t ...

  5. libtorch Tensor cannot be used as a tuple

    Tensor cannot be used as a tuple torch.jit.script_method  Tensor cannot be used as a tuple 错误代码: 函数返 ...

  6. JavaScript玩转机器学习:张量(Tensors) 和 操作(operations)

    JavaScript玩转机器学习:张量(Tensors) 和 操作(operations) 张量(Tensors) 和 操作(operations) TensorFlow.js是一个在JavaScri ...

  7. Output tensors to a Model must be the output of a TensorFlow `Layer`

    Output tensors to a Model must be the output of a TensorFlow Layer 使用tensorflow.keras构造网络的时候出现如下错误: ...

  8. pytorch小知识点(三)-------Tensor的indices操作

    一.Tesnor 先简单介绍一下Tensor.Tensor是pytorch的核心,它是一个包含单一数据类型的多维矩阵. pyTorch定义了七种CPU tensor类型和八种GPU tensor类型: ...

  9. Tensor (张量) - 神经网络中的数据结构

    Tensor (张量) - 神经网络中的数据结构 Tensor - Data Representation in Neural Networks Tensors are the fundamental ...

最新文章

  1. CSMA/CD--CSMA/CA
  2. 解决nginx+php二级页面显示空白的问题
  3. 10个常见的Redis面试刁难问题--转
  4. 第二课 运算符(day10)
  5. JAXP进行DOM和SAX解析
  6. setGeometry: Unable to set geometry 493x379+674+326 (frame: 517x443+662+274) on QWidgetWindow/“Dialo
  7. 2017.3.29 lis 失败总结
  8. (转)MyBatis框架的学习(四)——Mapper.xml文件中的输入和输出映射以及动态sql
  9. 查看创建的hive表对应的hdfs文件路径
  10. 北航 2011年考研复试题2
  11. 设置gmail邮箱代收的方法
  12. 基于机器学习的量化投资策略
  13. 没键盘计算机能启动吗,电脑没有接鼠标键盘为什么会影响电脑的正常开机?
  14. “油猴脚本”获取百度云文件URL,百度云速度破解
  15. 计算机的未来无可限量英文,(整理笔记)Day86【BBC】无人驾驶5:无人驾驶已是大势所趋 The trend of driverless cars is unstoppable...
  16. 07_音频录制01_命令行
  17. Photoshop:使用层遮照制作图像渐变特效(2)
  18. 向量的外积(outer product)与克罗内克积(Kronecker)
  19. 折线(Polyline)、多边形(Polygon)
  20. VR看房:全景图和移动切换的实现

热门文章

  1. Servlet | 访问不同格式文件(PDF、doc)
  2. 软件测试面试点_02
  3. shell脚本(二)--if流程控制语句和for循环语句的使用
  4. 深圳python编程培训哪个好
  5. 论文速读系列一:VoteNet、CBGS、BirdNet、StarNet、STD
  6. 微信小程序直播 ---微信官方组件简单使用
  7. Failed to configure a DataSource: 'url' attribute is not specified and no embedd
  8. Day01 python基础1
  9. 19岁少年重塑CPU,降低80%计算机功耗
  10. 中文字幕index10html,首页常用-[index.html]