Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
11
def
tensor2var(x, grad=False):
12
if
torch.cuda.is_available():
13
x = x.cuda()
14
return
Variable(x, requires_grad=grad)
15
16
def
var2tensor(x):
17
return
x.data.cpu()
Callers
1
train
Method · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected