Created by: zhupengyang
-
为concat python api的输入x加类型检查:
- 检查类型是否为Variable
- 检查数据类型是否为float16(gpu only), float32, float64, int32, int64
- 在单测中覆盖类型错误和数据类型错误两个异常情况
-
为concat op的输入加shape检查
测试样例:
import paddle.fluid as fluid
import numpy as np
in1 = np.array([[1,2,3],
[4,5,6]])
in2 = np.array([[1,2],
[3,4],
[5,6]])
with fluid.dygraph.guard():
x1 = fluid.dygraph.to_variable(in1)
x2 = fluid.dygraph.to_variable(in2)
out = fluid.layers.concat(input=[x1,x2], axis=0)
print(out.numpy())
修改前的报错信息:
Input tensors should have the same elements except the specify axis
修改后的报错信息:
Input tensors should have same dimensions(or specific dimension = -1) except the axis. But recevied axis = 0, input[0]'s shape = [2, 3], input[1]'s shape = [3, 2], the "1" dimension of input[1] is unexpected