工作生活

Pytorch: move data into CUDA

2019-06-30  本文已影响0人  Andy512

move data into CUDA:

cudafy = lambda x : x if cuda is None else x.cuda(cuda)
cudafy(model)

convert data from tensor (in GPU) to numpy (in cpu):

torch2np = lambda x : x.cpu().detach().numpy()
上一篇 下一篇

猜你喜欢

热点阅读