摘要: gather(input, dim, index):根据 index,在 dim 维度上选取数据,输出的 size 与 index 一致 # input (Tensor) – 源张量 # dim (int) – 索引的轴 # index (LongTensor) – 聚合元素的下标(index需要是 阅读全文
posted @ 2020-05-14 12:59 珠江水手 阅读(2117) 评论(0) 推荐(0) 编辑
摘要: 抄过来,帮助学习,防丢失。 原文链接:https://www.cnblogs.com/Simon-xm/p/4034416.html 这是一篇在Stack overflow上 很热的帖子。提问者自称已经掌握了有关Python OOP编程中的各种概念,但始终觉得元类(metaclass)难以理解。他知 阅读全文
posted @ 2020-06-05 15:59 珠江水手 阅读(61) 评论(0) 推荐(0) 编辑
摘要: python版本:Python 3.8.2 pytorch版本:1.5.0+cpu import torch torch.set_default_tensor_type('torch.IntTensor') # tensor 类型设置默认类型语句:输入为字符:' ' 报错: Traceback (m 阅读全文
posted @ 2020-05-21 09:47 珠江水手 阅读(1135) 评论(1) 推荐(0) 编辑
摘要: 书中(pytorch入门实战)讲:index_select(input, dim, index),指定维度dim上选取,未有示例。 查到相关资料后, import torch as t # 导入torch模块c = t.randn(3, 6) # 定义tensorprint(c)b = t.inde 阅读全文
posted @ 2020-05-12 11:22 珠江水手 阅读(1224) 评论(0) 推荐(1) 编辑
摘要: 参考:https://www.cnblogs.com/zf-blog/p/10613981.html https://www.cnblogs.com/andywenzhi/p/7453374.html?tdsourcetag=s_pcqq_aiomsg python的赋值方式是数据建立内存单元,将数 阅读全文
posted @ 2020-03-04 15:03 珠江水手 阅读(9604) 评论(0) 推荐(0) 编辑