!19179 dataset: judge return value first to present more clear error msg
Merge pull request !19179 from ms_yan/error_log
This commit is contained in:
commit
8679413627
|
@ -74,6 +74,9 @@ class _SharedQueue(multiprocessing.queues.Queue):
|
|||
name_list = []
|
||||
count = 0
|
||||
start_bytes = 0
|
||||
if not isinstance(data, tuple) and not isinstance(data, np.ndarray):
|
||||
raise TypeError("return value of user defined python function in GeneratorDataset or"
|
||||
" map should be numpy array or tuple of numpy array.")
|
||||
for r in data:
|
||||
if (isinstance(r, np.ndarray) and r.size > self.min_shared_mem
|
||||
and start_bytes + r.nbytes < self.seg_size):
|
||||
|
|
Loading…
Reference in New Issue