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()
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()
本文标题:Pytorch: move data into CUDA
本文链接:https://www.haomeiwen.com/subject/qzuicctx.html
网友评论