out1=torch.ones(1,1,5)#产生三维的tensor
print(list(out1.size( )))#输出tensor的形状,以列表返回
out = out1.view(out1.size(0), -1)
print(out)
out = F.dropout(out, p=0.5)#以0.5的概率使得神经元失活,值变为0,但是不改变tensor的形状
print(out)
pytorch网络的输入为tensor
最新推荐文章于 2024-02-25 18:08:20 发布