utils.py 183 Bytes
Newer Older
rusty1s's avatar
rusty1s committed
1
2
3
4
5
6
7
8
9
import torch
from torch._tensor_docs import tensor_classes

tensor_strs = [t[:-4] for t in tensor_classes]


def Tensor(str, x):
    tensor = getattr(torch, str)
    return tensor(x)