1 2 3 4 5 6 7 8 9 10 11 12
from torch.autograd import Variable EPS = 1e-15 def to_var(x): """# Convert to variable""" import torch if torch.cuda.is_available(): x = x.cuda() return Variable(x)