new.py 150 Bytes
Newer Older
rusty1s's avatar
rusty1s committed
1
2
3
4
5
6
import torch
from torch.autograd import Variable


def new(x, *sizes):
    return x.new(sizes) if torch.is_tensor(x) else Variable(x.data.new(sizes))