Created by: liym27
Api Switch 增强输入类型检查 [仅涉及python端]
class paddle.fluid.layers.Switch(name=None)
case(condition)
的输入condition
:
检查成员函数- 检查类型是否为Variable
- 检查数据类型是否为"bool",
报错样例:
TypeError: The data type of 'condition' in the member function case of fluid.layer.Switch must be ['bool'], but received float32.
TypeError: The type of 'condition' in the member function case of Switch must be <class 'paddle.fluid.framework.Variable'>, but received <type 'int'>.