aboutsummaryrefslogtreecommitdiff
path: root/code/sunlab/suntorch/models/variational/common.py
blob: f10930eab89b6772560f6e16cd72e1c49c6059b5 (plain)
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)