from __future__ import print_function
from torch.autograd import Variable as V
import torch as t
a=t.tensor(1,dtype=t.float)
print(a,a.shape,a.dtype)
b=V(t.tensor([1,1,1]))
print(b,b.shape,b.dtype)
c=t.tensor([1,1,1,1])
print(c,c.shape,c.dtype)
/home/wangbin/anaconda3/envs/deep_learning/bin/python3.7 /home/wangbin/anaconda3/envs/deep_learning/project/main.py
tensor(1.) torch.Size([]) torch.float32
tensor([1, 1, 1]) torch.Size([3]) torch.int64
tensor([1, 1, 1, 1]) torch.Size([4]) torch.int64
Process finished with exit code 0
版权声明:本文为nyist_yangguang原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。