Add some clearer error messages

This commit is contained in:
darkliang
2021-12-29 17:14:03 +08:00
parent bddd552907
commit 19ed960b0a
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ class DataSet(tordata.Dataset):
data_list.append(_)
for data in data_list:
if len(data) != len(data_list[0]):
raise AssertionError
raise ValueError('Each input data should have the same length.')
return data_list
+1 -1
View File
@@ -63,7 +63,7 @@ class InferenceSampler(tordata.sampler.Sampler):
rank = dist.get_rank()
if batch_size % world_size != 0:
raise AssertionError("World size({}) need be divisible by batch_size({})".format(
raise ValueError("World size({}) is not divisible by batch_size({})".format(
world_size, batch_size))
if batch_size != 1: