随笔分类 -  Pytorch函数

摘要:《动手pytorch》 cat :cconcatenate,拼接 1 import torch 2 n_train,n_test = 100,100 3 features = torch.randn((n_train+n_test)) 4 poly_features = torch.cat((fea 阅读全文
posted @ 2020-08-16 20:16 此间一看客 阅读(850) 评论(0) 推荐(0)
摘要:《动手学Pytorch》: 代码: y_hat =torch.tensor([[0.1,0.3,0.6],[0.3.0.2.0.5]]) y = torch.LongTensor([0,2]) y_hat.gather(1,y.view(-1,1)) 输出: tensor([[0.1000, [0. 阅读全文
posted @ 2020-08-15 15:46 此间一看客 阅读(724) 评论(0) 推荐(0)