Jittor / jittor

Jittor is a high-performance deep learning framework based on JIT compiling and meta-operators.
https://cg.cs.tsinghua.edu.cn/jittor/
Apache License 2.0
3.08k stars 311 forks source link

How to integrate with torch data? #192

Open cuge1995 opened 3 years ago

cuge1995 commented 3 years ago

If a torch data is

a = torch.rand(3)
b = jt.float(a)

this can convert torch data to jittor, but how to convert jittor data to torch ?

lzhengning commented 3 years ago

Firstly, convert jittor var to numpy. Then you can use it in torch.

a = torch.rand(3)
b = jt.float(a)
c = b.data    # numpy array
d = torch.from_numpy(c)