Browse Source

Correct dataset error checking

tags/v0.3.0-alpha
Cathy Wong chang zherui 5 years ago
parent
commit
c0e2a63fdb
2 changed files with 4 additions and 6 deletions
  1. +0
    -2
      mindspore/dataset/engine/datasets.py
  2. +4
    -4
      mindspore/dataset/engine/validators.py

+ 0
- 2
mindspore/dataset/engine/datasets.py View File

@@ -82,8 +82,6 @@ def zip(datasets):
if len(datasets) <= 1:
raise ValueError(
"Can't zip empty or just one dataset!")
if not isinstance(datasets, tuple):
raise TypeError("The zip function %s type error!" % (datasets))
return ZipDataset(datasets)




+ 4
- 4
mindspore/dataset/engine/validators.py View File

@@ -105,13 +105,13 @@ def check(method):
"The %s function %s exceeds the boundary!" % (
func_name, param_name))
if isinstance(arg, int) and param_name == "num_parallel_workers" and (
arg <= 0 or arg > cpu_count()):
arg < 1 or arg > cpu_count()):
raise ValueError(
"The %s function %s exceeds the boundary(%s)!" % (
func_name, param_name, cpu_count()))
if isinstance(arg, int) and param_name != "seed" \
and param_name != "count" and param_name != "prefetch_size" \
and param_name != "num_parallel_workers" and (arg <= 0 or arg > 2147483647):
and param_name != "num_parallel_workers" and (arg < 1 or arg > 2147483647):
raise ValueError(
"The %s function %s exceeds the boundary!" % (
func_name, param_name))
@@ -271,8 +271,8 @@ def check_interval_closed(param, param_name, valid_range):

def check_num_parallel_workers(value):
check_type(value, 'num_parallel_workers', int)
if value <= 0 or value > cpu_count():
raise ValueError("num_parallel_workers exceeds the boundary between 0 and {}!".format(cpu_count()))
if value < 1 or value > cpu_count():
raise ValueError("num_parallel_workers exceeds the boundary between 1 and {}!".format(cpu_count()))


def check_num_samples(value):


Loading…
Cancel
Save