提交 c0e2a63f 编写于 作者: C Cathy Wong 提交者: 高东海

Correct dataset error checking

上级 513f384c
......@@ -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)
......
......@@ -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):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册