Created by: zhupengyang
prelu op 报错信息增强 [C++ && python]
c++不合规报错检查增强
1. 使用OP_INOUT_CHECK,检查输入输出是否设置
- 输入X是否设置
- 修改前
Error: Input(X) of PreluOp should not be null
- 修改后
NotFoundError: No Input(X) found for prelu operator
- 输入alpha是否设置
- 修改前
Error: Input(Alpha) of PreluOp should not be null
- 修改后
NotFoundError: No Input(Alpha) found for prelu operator
- 输出out是否设置
- 修改前
Error: Output(Out) of PreluOp should not be null
- 修改后
NotFoundError: No Output(Out) found for prelu operator
- 反向输入out@grad是否存在
- 修改前
Error: Output(Out) of PreluOp should not be null
- 修改后
NotFoundError: No Input(Out@GRAD) found for prelu operator
2. 输入维度是否正确
- all 模式下,alpha的size必须为1
- 修改前
Error: For mode 'all', size of weight Alpha must be one.
- 修改后
InvalidArgument Error: For mode 'all', size of weight Alpha must be one.
- channel 模式下,alpha的size必须等于输入x的channel数
- 假设alpha's size=2, x's channel=3
- 修改前
Error: For channel-wise mode, size of weight Alpha must be equal to the number of channels, should be 3
- 修改后
InvalidArgument Error: For mode 'channel', size of weight Alpha must be equal to the number of channels of input(x). But recevied alpha's size: 2, x_dim[1]: 3
- element 模式下,alpha的rank必须等于输入x的rank
- 假设alpha's rank=2, x's rank=3
- 修改前
Error: For element-wise mode, rank of weight Alpha must be equal to the rank of input.
- 修改后
InvalidArgument Error: For mode 'element', rank of weight Alpha must be equal to the rank of input(x). But recevied alpha's rank: 2, x's rank: 3.
- element 模式下,alpha的size必须等于输入x的size
- 假设alpha's size=20, x's size=30
- 修改前
Error: For element-wise mode, size of weight Alpha must be equal to the number of input.
- 修改后
InvalidArgument Error: For mode 'element', the size of weight Alpha must be equal to the size of input(x). But recevied alpha's size: 20, x's size: 30.
python不合规报错检查增强
- 检查
x
是否为variable,且是否dtype为float32,float64