Merge pull request !194 from pengyanjun/fix_dataset_para_validator_checktags/v0.2.0-alpha
| @@ -127,7 +127,6 @@ class RandomSampler(): | |||||
| Raises: | Raises: | ||||
| ValueError: If replacement is not boolean. | ValueError: If replacement is not boolean. | ||||
| ValueError: If num_samples is not None and replacement is false. | |||||
| ValueError: If num_samples is not positive. | ValueError: If num_samples is not positive. | ||||
| """ | """ | ||||
| @@ -556,6 +556,11 @@ def check_generatordataset(method): | |||||
| if column_names is None: | if column_names is None: | ||||
| raise ValueError("column_names is not provided.") | 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_int, param_dict, int) | ||||
| check_param_type(nreq_param_list, param_dict, list) | 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.") | raise ValueError("The size of the padding list or tuple should be 2 or 4.") | ||||
| else: | else: | ||||
| raise TypeError("Padding can be any of: a number, a tuple or list of size 2 or 4.") | 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 | return left, top, right, bottom | ||||