Merge pull request #169 from Jittor/dataset

fix dataset to_jittor bug
This commit is contained in:
zhouwy19 2020-12-16 15:57:46 +08:00 committed by GitHub
commit cf8ba20fe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -117,6 +117,7 @@ class Dataset(object):
'''
Change batch data to jittor array, such as np.ndarray, int, and float.
'''
if isinstance(batch, jt.Var): return batch
to_jt = lambda x: jt.array(x).stop_grad() \
if self.stop_grad else jt.array(x)
if isinstance(batch, np.ndarray):