jittor icon indicating copy to clipboard operation
jittor copied to clipboard

How to integrate with torch data?

Open cuge1995 opened this issue 4 years ago • 1 comments

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 ?

cuge1995 avatar Mar 25 '21 07:03 cuge1995

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)

lzhengning avatar Apr 29 '21 12:04 lzhengning