已合并
池化类算子proto新增宏隔离 #8435
池化类算子proto新增宏隔离 #8435
已合并
小王!创建于 24 天前
9 个文件变更+32-5
@@ -39,11 +39,14 @@ namespace ge {
39* @par Third-party framework compatibility39* @par Third-party framework compatibility
40* Compatible with the Pytorch operator AdaptiveAvgPool2d.40* Compatible with the Pytorch operator AdaptiveAvgPool2d.
41*/41*/
42+#ifndef OPS_PROTO_DEF_ADAPTIVEAVGPOOL2D
43+#define OPS_PROTO_DEF_ADAPTIVEAVGPOOL2D
42REG_OP(AdaptiveAvgPool2d)44REG_OP(AdaptiveAvgPool2d)
43 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))45 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
44 .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))46 .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
45 .REQUIRED_ATTR(output_size, ListInt)47 .REQUIRED_ATTR(output_size, ListInt)
46 .OP_END_FACTORY_REG(AdaptiveAvgPool2d)48 .OP_END_FACTORY_REG(AdaptiveAvgPool2d)
49+#endif
47} // namespace ge50} // namespace ge
48 51 
49-#endif // OPS_POOLING_ADAPTIVE_AVG_POOL2D_PROTO_H_52+#endif // OPS_POOLING_ADAPTIVE_AVG_POOL2D_PROTO_H_
@@ -35,11 +35,14 @@ namespace ge {
35* @par Third-party framework compatibility35* @par Third-party framework compatibility
36* Compatible with the Pytorch operator AdaptiveAvgPool2dGrad.36* Compatible with the Pytorch operator AdaptiveAvgPool2dGrad.
37*/37*/
38+#ifndef OPS_PROTO_DEF_ADAPTIVEAVGPOOL2DGRAD
39+#define OPS_PROTO_DEF_ADAPTIVEAVGPOOL2DGRAD
38REG_OP(AdaptiveAvgPool2dGrad)40REG_OP(AdaptiveAvgPool2dGrad)
39 .INPUT(input_grad, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))41 .INPUT(input_grad, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
40 .OUTPUT(output_grad, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))42 .OUTPUT(output_grad, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
41 .REQUIRED_ATTR(orig_input_shape, ListInt)43 .REQUIRED_ATTR(orig_input_shape, ListInt)
42 .OP_END_FACTORY_REG(AdaptiveAvgPool2dGrad)44 .OP_END_FACTORY_REG(AdaptiveAvgPool2dGrad)
45+#endif
43 46 
44} // namespace ge47} // namespace ge
45#endif // OPS_POOLING_ADAPTIVE_AVG_POOL2D_GRAD_PROTO_H_48#endif // OPS_POOLING_ADAPTIVE_AVG_POOL2D_GRAD_PROTO_H_
@@ -51,6 +51,8 @@ namespace ge {
51* @par Third-party framework compatibility51* @par Third-party framework compatibility
52* @li Compatible with the TensorFlow operator AvgPoolGrad.52* @li Compatible with the TensorFlow operator AvgPoolGrad.
53*/53*/
54+#ifndef OPS_PROTO_DEF_AVGPOOLGRAD
55+#define OPS_PROTO_DEF_AVGPOOLGRAD
54REG_OP(AvgPoolGrad)56REG_OP(AvgPoolGrad)
55 .INPUT(orig_input_shape, TensorType({DT_INT32}))57 .INPUT(orig_input_shape, TensorType({DT_INT32}))
56 .INPUT(input_grad, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE, DT_BF16}))58 .INPUT(input_grad, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE, DT_BF16}))
@@ -60,6 +62,7 @@ REG_OP(AvgPoolGrad)
60 .REQUIRED_ATTR(padding, String)62 .REQUIRED_ATTR(padding, String)
61 .ATTR(data_format, String, "NHWC")63 .ATTR(data_format, String, "NHWC")
62 .OP_END_FACTORY_REG(AvgPoolGrad)64 .OP_END_FACTORY_REG(AvgPoolGrad)
65+#endif
63 66 
64} // namespace ge67} // namespace ge
65#endif // OP_PROTO_AVG_POOL_GRAD_H_68#endif // OP_PROTO_AVG_POOL_GRAD_H_
@@ -60,6 +60,8 @@ namespace ge {
60* @par Third-party framework compatibility60* @par Third-party framework compatibility
61* @li Compatible with the TensorFlow operator AvgPoolGrad.61* @li Compatible with the TensorFlow operator AvgPoolGrad.
62*/62*/
63+#ifndef OPS_PROTO_DEF_AVGPOOLV2GRAD
64+#define OPS_PROTO_DEF_AVGPOOLV2GRAD
63REG_OP(AvgPoolV2Grad)65REG_OP(AvgPoolV2Grad)
64 .INPUT(orig_input_shape, TensorType({DT_INT32}))66 .INPUT(orig_input_shape, TensorType({DT_INT32}))
65 .INPUT(input_grad, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE, DT_BF16}))67 .INPUT(input_grad, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE, DT_BF16}))
@@ -74,6 +76,7 @@ REG_OP(AvgPoolV2Grad)
74 .ATTR(exclusive, Bool, true)76 .ATTR(exclusive, Bool, true)
75 .ATTR(divisor_override, Int, 0)77 .ATTR(divisor_override, Int, 0)
76 .OP_END_FACTORY_REG(AvgPoolV2Grad)78 .OP_END_FACTORY_REG(AvgPoolV2Grad)
79+#endif
77 80 
78} // namespace ge81} // namespace ge
79-#endif // OP_PROTO_AVG_POOL_V2_GRAD_H_82+#endif // OP_PROTO_AVG_POOL_V2_GRAD_H_
@@ -59,6 +59,8 @@ and VALID.
59* @par Third-party framework compatibility59* @par Third-party framework compatibility
60* Compatible with the Torch operator MaxPool3DGrad.60* Compatible with the Torch operator MaxPool3DGrad.
61*/61*/
62+#ifndef OPS_PROTO_DEF_MAXPOOL3DGRAD
63+#define OPS_PROTO_DEF_MAXPOOL3DGRAD
62REG_OP(MaxPool3DGrad)64REG_OP(MaxPool3DGrad)
63 .INPUT(orig_x, TensorType::RealNumberType())65 .INPUT(orig_x, TensorType::RealNumberType())
64 .INPUT(orig_y, TensorType::RealNumberType())66 .INPUT(orig_y, TensorType::RealNumberType())
@@ -70,5 +72,6 @@ REG_OP(MaxPool3DGrad)
70 .REQUIRED_ATTR(pads, ListInt)72 .REQUIRED_ATTR(pads, ListInt)
71 .ATTR(data_format, String, "NDHWC")73 .ATTR(data_format, String, "NDHWC")
72 .OP_END_FACTORY_REG(MaxPool3DGrad)74 .OP_END_FACTORY_REG(MaxPool3DGrad)
75+#endif
73} // namespace ge76} // namespace ge
74#endif // OPS_BUILT_IN_OP_PROTO_INC_MAX_POOL3D_GRAD_PROTO_H_77#endif // OPS_BUILT_IN_OP_PROTO_INC_MAX_POOL3D_GRAD_PROTO_H_
@@ -61,6 +61,8 @@ mask.
61* Compatible with the PyTorch backward operator of max_pool2d_with_indices.61* Compatible with the PyTorch backward operator of max_pool2d_with_indices.
62*/62*/
63 63 
64+#ifndef OPS_PROTO_DEF_MAXPOOLGRADWITHARGMAXV1
65+#define OPS_PROTO_DEF_MAXPOOLGRADWITHARGMAXV1
64REG_OP(MaxPoolGradWithArgmaxV1)66REG_OP(MaxPoolGradWithArgmaxV1)
65 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))67 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
66 .INPUT(grad, TensorType({DT_FLOAT16, DT_FLOAT}))68 .INPUT(grad, TensorType({DT_FLOAT16, DT_FLOAT}))
@@ -73,5 +75,6 @@ REG_OP(MaxPoolGradWithArgmaxV1)
73 .ATTR(dilation, ListInt, {1, 1, 1, 1})75 .ATTR(dilation, ListInt, {1, 1, 1, 1})
74 .ATTR(ceil_mode, Bool, false)76 .ATTR(ceil_mode, Bool, false)
75 .OP_END_FACTORY_REG(MaxPoolGradWithArgmaxV1)77 .OP_END_FACTORY_REG(MaxPoolGradWithArgmaxV1)
78+#endif
76} // namespace ge79} // namespace ge
77-#endif80+#endif
@@ -54,6 +54,8 @@ mask. \n
54* @par Third-party framework compatibility54* @par Third-party framework compatibility
55* Compatible with the PyTorch operator max_pool2d_with_indices.55* Compatible with the PyTorch operator max_pool2d_with_indices.
56*/56*/
57+#ifndef OPS_PROTO_DEF_MAXPOOLWITHARGMAXV1
58+#define OPS_PROTO_DEF_MAXPOOLWITHARGMAXV1
57REG_OP(MaxPoolWithArgmaxV1)59REG_OP(MaxPoolWithArgmaxV1)
58 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT32}))60 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT32}))
59 .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT32}))61 .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT32}))
@@ -65,6 +67,7 @@ REG_OP(MaxPoolWithArgmaxV1)
65 .ATTR(dilation, ListInt, {1, 1, 1, 1})67 .ATTR(dilation, ListInt, {1, 1, 1, 1})
66 .ATTR(ceil_mode, Bool, false)68 .ATTR(ceil_mode, Bool, false)
67 .OP_END_FACTORY_REG(MaxPoolWithArgmaxV1)69 .OP_END_FACTORY_REG(MaxPoolWithArgmaxV1)
70+#endif
68 71 
69} // namespace ge72} // namespace ge
70-#endif73+#endif
@@ -45,6 +45,8 @@ namespace ge {
45* @par Third-party framework compatibility45* @par Third-party framework compatibility
46* Compatible with the TensorFlow operator MaxPoolGrad.46* Compatible with the TensorFlow operator MaxPoolGrad.
47*/47*/
48+#ifndef OPS_PROTO_DEF_MAXPOOLGRAD
49+#define OPS_PROTO_DEF_MAXPOOLGRAD
48REG_OP(MaxPoolGrad)50REG_OP(MaxPoolGrad)
49 .INPUT(x1, TensorType::RealNumberType())51 .INPUT(x1, TensorType::RealNumberType())
50 .INPUT(x2, TensorType::RealNumberType())52 .INPUT(x2, TensorType::RealNumberType())
@@ -55,6 +57,7 @@ REG_OP(MaxPoolGrad)
55 .REQUIRED_ATTR(padding, String)57 .REQUIRED_ATTR(padding, String)
56 .ATTR(data_format, String, "NHWC")58 .ATTR(data_format, String, "NHWC")
57 .OP_END_FACTORY_REG(MaxPoolGrad)59 .OP_END_FACTORY_REG(MaxPoolGrad)
60+#endif
58} // namespace ge61} // namespace ge
59 62 
60#endif // OPS_BUILT_IN_OP_PROTO_INC_NN_POOLING_OPS_H63#endif // OPS_BUILT_IN_OP_PROTO_INC_NN_POOLING_OPS_H
@@ -61,6 +61,8 @@ namespace ge {
61* @par Third-party framework compatibility61* @par Third-party framework compatibility
62* Compatible with the TensorFlow operator MaxPool.62* Compatible with the TensorFlow operator MaxPool.
63*/63*/
64+#ifndef OPS_PROTO_DEF_MAXPOOL
65+#define OPS_PROTO_DEF_MAXPOOL
64REG_OP(MaxPool)66REG_OP(MaxPool)
65 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE, DT_INT8, DT_INT16, DT_INT32, DT_INT64, DT_UINT8, DT_UINT16,67 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT32, DT_DOUBLE, DT_INT8, DT_INT16, DT_INT32, DT_INT64, DT_UINT8, DT_UINT16,
66 DT_QINT8}))68 DT_QINT8}))
@@ -71,6 +73,7 @@ REG_OP(MaxPool)
71 .REQUIRED_ATTR(padding, String)73 .REQUIRED_ATTR(padding, String)
72 .ATTR(data_format, String, "NHWC")74 .ATTR(data_format, String, "NHWC")
73 .OP_END_FACTORY_REG(MaxPool)75 .OP_END_FACTORY_REG(MaxPool)
76+#endif
74 77 
75} // namespace ge78} // namespace ge
76-#endif79+#endif