摘要: 官方文档 CLASS torch.nn.parameter.Parameter(data=None, requires_grad=True) A kind of Tensor that is to be considered a module parameter. Parameters are Te 阅读全文
posted @ 2022-03-17 15:04 ArdenWang 阅读(623) 评论(0) 推荐(0) 编辑
摘要: torch.mul(a, b) 点乘:对应位相乘,维度必须相等 返回维度与 a, b 相同 torch.mm(a, b) 矩阵相乘 如: a: [1, 2] b: [2, 3] output: [1, 3] torch.bmm(a, b) a, b必须是3D维度的,对两个向量维度有要求。 a: [p 阅读全文
posted @ 2022-03-17 14:03 ArdenWang 阅读(1592) 评论(0) 推荐(1) 编辑
摘要: torchtext.legacy.data torchtext.legacy.data.Example : 用来表示一个样本,数据+标签 torchtext.legacy.vocab.Vocab: 词汇表相关 torchtext.legacy.data.Datasets: 数据集类,getitem 阅读全文
posted @ 2022-03-17 11:06 ArdenWang 阅读(388) 评论(0) 推荐(0) 编辑
摘要: tensor.is_cuda True / False 阅读全文
posted @ 2022-03-17 10:42 ArdenWang 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 只要随机数种子N是不变的,那么只要np.random.seed(N)或者torch.manual_seed(N)被执行,那么产生随机数就是一样的。 比如说在训练模型的程序中,只包含一次np.random.seed(N)和torch.manual_seed(N) 操作: 每次运行该程序文件的时候,由于 阅读全文
posted @ 2022-03-17 08:05 ArdenWang 阅读(98) 评论(0) 推荐(1) 编辑