Created by: liym27
switch api 增强输入类型检查
switch_case(branch_index, branch_fns, default=None, name=None)
-
检查
branch_index
:- 检查类型是否为Variable
- 检查数据类型是否为"uint8", "int32", "int64"
-
检查
branch_fns
:- 检查类型是否为 list, tuple, dict
TypeError: The type of 'branch_fns' in switch_case must be (<type 'list'>, <type 'tuple'>, <type 'dict'>), but received <type 'int'>.
注:该api原本的报错信息已很完善,本PR尽可能将类型检查统一用check_variable_and_dtype
和check_type
接口。无法统一到上述2个接口的,不做修改。