add from_torch

This commit is contained in:
zhouwy19 2022-12-02 17:21:18 +08:00
parent be8faf4dfc
commit 725615872a
1 changed files with 6 additions and 0 deletions

View File

@ -1985,3 +1985,9 @@ def cpu(x): return x.clone()
jt.Var.cpu = cpu
def to(x, *args, **kargs): return x.clone()
jt.Var.to = to
def from_torch(x):
'''
Convert torch Tensor to Jittor Var
'''
return jt.Var(x.cpu().numpy())