forked from mindspore-Ecosystem/mindspore
num_shards and sampler is not supported if source does not have __getitem__
This commit is contained in:
parent
64b3b566ab
commit
203b05d458
|
@ -587,6 +587,11 @@ def check_generatordataset(method):
|
|||
except TypeError:
|
||||
raise TypeError("sampler should be either iterable or from mindspore.dataset.samplers")
|
||||
|
||||
if sampler is not None and not hasattr(source, "__getitem__"):
|
||||
raise ValueError("sampler is not supported if source does not have attribute '__getitem__'")
|
||||
if num_shards is not None and not hasattr(source, "__getitem__"):
|
||||
raise ValueError("num_shards is not supported if source does not have attribute '__getitem__'")
|
||||
|
||||
return method(*args, **kwargs)
|
||||
|
||||
return new_method
|
||||
|
|
Loading…
Reference in New Issue