forked from mindspore-Ecosystem/mindspore
fix dataset para validator check
This commit is contained in:
parent
086edc133f
commit
363632ca9d
|
@ -127,7 +127,6 @@ class RandomSampler():
|
|||
|
||||
Raises:
|
||||
ValueError: If replacement is not boolean.
|
||||
ValueError: If num_samples is not None and replacement is false.
|
||||
ValueError: If num_samples is not positive.
|
||||
"""
|
||||
|
||||
|
|
|
@ -556,6 +556,11 @@ def check_generatordataset(method):
|
|||
if column_names is None:
|
||||
raise ValueError("column_names is not provided.")
|
||||
|
||||
# check prefetch_size range
|
||||
prefetch_size = param_dict.get('prefetch_size')
|
||||
if prefetch_size is not None and (prefetch_size <= 0 or prefetch_size > 1024):
|
||||
raise ValueError("prefetch_size exceeds the boundary.")
|
||||
|
||||
check_param_type(nreq_param_int, param_dict, int)
|
||||
|
||||
check_param_type(nreq_param_list, param_dict, list)
|
||||
|
|
|
@ -104,6 +104,10 @@ def check_padding(padding):
|
|||
raise ValueError("The size of the padding list or tuple should be 2 or 4.")
|
||||
else:
|
||||
raise TypeError("Padding can be any of: a number, a tuple or list of size 2 or 4.")
|
||||
if not (isinstance(left, int) and isinstance(top, int) and isinstance(right, int) and isinstance(bottom, int)):
|
||||
raise TypeError("Padding value should be integer.")
|
||||
if left < 0 or top < 0 or right < 0 or bottom < 0:
|
||||
raise ValueError("Padding value could not be negative.")
|
||||
return left, top, right, bottom
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue