摘要: 1 导入实验所需要的包 import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms import torch.nn.functional as F from tor 阅读全文
posted @ 2022-03-30 09:09 多发Paper哈 阅读(1138) 评论(0) 推荐(0) 编辑
摘要: 1、import from numpy / list 方法:torch.from_numpy(ndarray) 常见的初始化有torch.tensor和torch.Tensor 区别: tensor():通过numpy 或 list 的现有数据初始化 Tensor(): 1、接收数据的维度(,)sh 阅读全文
posted @ 2022-03-30 00:45 多发Paper哈 阅读(864) 评论(0) 推荐(1) 编辑
摘要: torch.flatten() torch.flatten(x) 等于 torch.flatten(x,0) 默认将张量拉成一维的向量,也就是说从第一维开始平坦化,torch.flatten(x,1) 代表从第二维开始平坦化。 Example: import torch x=torch.randn( 阅读全文
posted @ 2022-03-30 00:39 多发Paper哈 阅读(3444) 评论(0) 推荐(0) 编辑
Live2D