当前位置:网站首页>Pytorch Summary - sensor on GPU
Pytorch Summary - sensor on GPU
2022-06-29 09:21:00 【TJMtaotao】
Method of use to() Can be Tensor stay CPU and GPU( Need hardware ⽀ Support ) Move with each other .
if torch.cuda.is_available(): # return True or False # When GPU Available as True, And vice versa False
device = torch.device("cuda") # GPU
y = torch.ones_like(x, device=device) # Create directly ⼀ It's in GPU Upper Tensor
x = x.to(device) # Equivalent to .to("cuda")
z = x + y
print(z)
print(z.to("cpu", torch.double)) # to() You can also 更 Change data type
边栏推荐
猜你喜欢

微信小程序最新canvas2d手写签名

微信小程序自定义多项选择器

Debugging H5 page -weinre and spy debugger real machine debugging

SSD improvements cfenet

Abstract classes and interfaces

Share code snippets of wechat applet

UE4 去掉材质中Mask透明白边

Wechat applet sharing page, sharing to the circle of friends

What is hyperfusion? What is the difference with traditional architecture

AugFPN:改进多尺度特征学习用于目标检测
随机推荐
Let's make a summary
Verilog shift operator
Uniapp wechat applet reports an error typeerror: cannot read property 'call' of undefined
MH/T 6040航空材料烟密度试验
cmd进入虚拟机
专业结构record
Which securities company is good for opening a mobile account? Is it safe to open an account online?
Handwriting Redux thunk
Verilog data type
微信小程序用户拒绝授权地理位置信息再次调起授权窗口
jar包和war包
【To .NET】C#数据模型,从Entity Framework Core到LINQ
H5 soft keyboard problem
查找字符串中重复次数最多的元素
Verilog splicing operation symbol
YOLACT实时实例分割
Universal target detection based on region attention
Written test question "arrange version numbers from large to small"
微信小程序自定义多项选择器
UE4 去掉材质中Mask透明白边