![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
torch基础
xmy21sunshine
这个作者很懒,什么都没留下…
展开
-
常见深度学习模型复杂度
复杂度原创 2022-10-11 15:45:39 · 201 阅读 · 0 评论 -
广播机制使用的例子:2维矩阵与3维矩阵的乘法(matmul)和 element-wise(mul)
广播机制原创 2022-06-16 17:37:35 · 1262 阅读 · 0 评论 -
利用正则表达式画loss图
import re data1_loss=[] data2_loss=[] #文件中各提取关键数值所在的位置 Epoch = 0 train_loss = 0 train_acc = 1 test_loss =2 test_acc = 3 f =open(“./loss.txt”, ‘r’, encoding=“utf8”) lines = f.readline() while lines: result1 = re.findall(r’\d+',lines) # 读取整数 result2 = re.fi原创 2022-05-16 21:00:18 · 145 阅读 · 0 评论 -
torch.cat的用法
torch.cat 将两个tensor拼接在一起,即拼接、联系在一起的意思; 使用torch.cat((A, B),dim)时,除拼接dim维对应的值不同外,其余维的数值需一致 A = torch.ones(2,3) B = 2 * torch.ones(4,3) C = torch.cat((A, B),dim=0) print(C.shape) D = 2 * torch.ones(2,4) C = torch.cat((A, D),dim=1) print(C.shape) ...原创 2022-04-22 14:09:23 · 186 阅读 · 0 评论