mirror of https://github.com/Jittor/Jittor
fix: to_tensor applied on a jt.Var
Allow jt.transform.to_tensor applied on a jt.Var (do nothing but return the inputs).
This commit is contained in:
parent
b3ee4a54e4
commit
4bd0c4a2f6
|
@ -408,6 +408,9 @@ def to_tensor(pic):
|
|||
img = Image.open(...)
|
||||
img_ = transform.to_tensor(img)
|
||||
"""
|
||||
if isinstance(pic, jt.Var):
|
||||
return pic
|
||||
|
||||
if isinstance(pic, tuple):
|
||||
# try convert ten crop tuple
|
||||
pic = ( to_tensor(pic) for p in pic )
|
||||
|
|
Loading…
Reference in New Issue