MCPcopy Create free account
hub / github.com/OUCMachineLearning/OUCML / tensor2var

Function tensor2var

GAN/self_attention _gan/utils.py:11–14  ·  view source on GitHub ↗
(x, grad=False)

Source from the content-addressed store, hash-verified

9
10
11def tensor2var(x, grad=False):
12 if torch.cuda.is_available():
13 x = x.cuda()
14 return Variable(x, requires_grad=grad)
15
16def var2tensor(x):
17 return x.data.cpu()

Callers 1

trainMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected