07 2022 档案

摘要:*位置乘 符号*在pytorch中是按位置相乘,存在广播机制。 例子: vec1 = torch.arange(4) vec2 = torch.tensor([4,3,2,1]) mat1 = torch.arange(12).reshape(4,3) mat2 = torch.arange(12) 阅读全文
posted @ 2022-07-24 20:53 CharlesLC 阅读(624) 评论(0) 推荐(0) 编辑
摘要:查看数据类型:dtype 例子1: In[1]: a = np.arange(5) In[2]: a.dtype Out[1]: dtype('int32') 例子2: In[1]: b = np.array([1.00, 2.00 ,3.00 ,4.00 ], dtype=np.float64) 阅读全文
posted @ 2022-07-22 19:07 CharlesLC 阅读(316) 评论(0) 推荐(0) 编辑
摘要:np.bincount() numpy官方文档中解释:Count number of occurrences of each value in array of non-negative ints 统计非负数整数出现的次数。索引是从零开始的,所以bin的长度会比统计向量长度大1。 例子: 另外,bi 阅读全文
posted @ 2022-07-21 13:08 CharlesLC 阅读(25) 评论(0) 推荐(0) 编辑
摘要:tensor to numpy tensor数据在cpu上: 如果tensor数据在cpu上,直接使用.numpy()就可以转化。 例子: 注意:torch 和 numpy 转化后 指向地址相同 如果修改原始数据,那么转换后的数据也会修改,例子: tensor数据在gpu上: 如果tensor数据在 阅读全文
posted @ 2022-07-21 11:27 CharlesLC 阅读(230) 评论(0) 推荐(0) 编辑
该文被密码保护。
posted @ 2022-07-11 21:46 CharlesLC 阅读(0) 评论(0) 推荐(0) 编辑
该文被密码保护。
posted @ 2022-07-03 23:45 CharlesLC 阅读(0) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示