提交 58302121 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!848 sampler and num_shards is not supported if source does not have attribute...

!848 sampler and num_shards is not supported if source does not have attribute '__getitem__ in GeneratorDataset
Merge pull request !848 from yanghaitao/yht_generator_sampler_numshards
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册