已合并
fix(op_graph): 30 个算子原型头补 OPS_PROTO_DEF 隔离宏 #9218
fix(op_graph): 30 个算子原型头补 OPS_PROTO_DEF 隔离宏 #9218
已合并
zl_hw创建于 8月25日
共 30 个文件变更+95-5
@@ -46,6 +46,8 @@ namespace ge {
46* The dim dimension of x must be divisible by 2, and the dim dimension of y must be equal to the dim dimension of x46* The dim dimension of x must be divisible by 2, and the dim dimension of y must be equal to the dim dimension of x
47divided by 2.47divided by 2.
48*/48*/
49+#ifndef OPS_PROTO_DEF_CLIPPEDSWIGLU
50+#define OPS_PROTO_DEF_CLIPPEDSWIGLU
49REG_OP(ClippedSwiglu)51REG_OP(ClippedSwiglu)
50 .INPUT(x, TensorType({DT_BF16, DT_FLOAT16, DT_FLOAT}))52 .INPUT(x, TensorType({DT_BF16, DT_FLOAT16, DT_FLOAT}))
51 .OPTIONAL_INPUT(group_index, TensorType({DT_INT64}))53 .OPTIONAL_INPUT(group_index, TensorType({DT_INT64}))
@@ -57,5 +59,6 @@ REG_OP(ClippedSwiglu)
57 .ATTR(interleaved, Bool, true)59 .ATTR(interleaved, Bool, true)
58 .ATTR(clamp_mode, Int, 0)60 .ATTR(clamp_mode, Int, 0)
59 .OP_END_FACTORY_REG(ClippedSwiglu)61 .OP_END_FACTORY_REG(ClippedSwiglu)
62+#endif // OPS_PROTO_DEF_CLIPPEDSWIGLU
60} // namespace ge63} // namespace ge
61#endif // OPS_BUILT_IN_OP_PROTO_INC_CLIPPED_SWIGLU_PROTO_H_64#endif // OPS_BUILT_IN_OP_PROTO_INC_CLIPPED_SWIGLU_PROTO_H_
@@ -35,12 +35,15 @@ namespace ge {
35 * @par Third-party framework compatibility35 * @par Third-party framework compatibility
36 * Compatible with the PyTorch operator torch.nn.Hardsigmoid.36 * Compatible with the PyTorch operator torch.nn.Hardsigmoid.
37 */37 */
38+#ifndef OPS_PROTO_DEF_HARDSIGMOID
39+#define OPS_PROTO_DEF_HARDSIGMOID
38REG_OP(HardSigmoid)40REG_OP(HardSigmoid)
39 .INPUT(input_x, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16, DT_INT32}))41 .INPUT(input_x, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16, DT_INT32}))
40 .OUTPUT(output_y, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16, DT_INT32}))42 .OUTPUT(output_y, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16, DT_INT32}))
41 .ATTR(alpha, Float, 0.16666666)43 .ATTR(alpha, Float, 0.16666666)
42 .ATTR(beta, Float, 0.5)44 .ATTR(beta, Float, 0.5)
43 .OP_END_FACTORY_REG(HardSigmoid)45 .OP_END_FACTORY_REG(HardSigmoid)
46+#endif // OPS_PROTO_DEF_HARDSIGMOID
44} // namespace ge47} // namespace ge
45 48 
46#endif // OPS_BUILT_IN_OP_PROTO_INC_HARD_SIGMOID_H_49#endif // OPS_BUILT_IN_OP_PROTO_INC_HARD_SIGMOID_H_
@@ -41,10 +41,13 @@ namespace ge {
41 *@par Third-party framework compatibility41 *@par Third-party framework compatibility
42 * Compatible with the PyTorch operator HardSwishGrad after v2.8.42 * Compatible with the PyTorch operator HardSwishGrad after v2.8.
43 */43 */
44+#ifndef OPS_PROTO_DEF_HARDSWISHGRADV2
45+#define OPS_PROTO_DEF_HARDSWISHGRADV2
44REG_OP(HardSwishGradV2)46REG_OP(HardSwishGradV2)
45 .INPUT(gradOutput, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))47 .INPUT(gradOutput, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))
46 .INPUT(self, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))48 .INPUT(self, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))
47 .OUTPUT(out, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))49 .OUTPUT(out, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))
48 .OP_END_FACTORY_REG(HardSwishGradV2)50 .OP_END_FACTORY_REG(HardSwishGradV2)
51+#endif // OPS_PROTO_DEF_HARDSWISHGRADV2
49} // namespace ge52} // namespace ge
50#endif // OPS_ACTIVATION_HARD_SWISH_GRAD_V2_GRAPH_PLUGIN_HARD_SWISH_GRAD_V2_PROTO_H_53#endif // OPS_ACTIVATION_HARD_SWISH_GRAD_V2_GRAPH_PLUGIN_HARD_SWISH_GRAD_V2_PROTO_H_
@@ -44,11 +44,14 @@ namespace ge {
44* Compatible with the TensorFlow operator Relu6Grad and PyTorch44* Compatible with the TensorFlow operator Relu6Grad and PyTorch
45* hardtanh_backward(min=0, max=6) at boundary x in {0, 6} returning 0.45* hardtanh_backward(min=0, max=6) at boundary x in {0, 6} returning 0.
46*/46*/
47+#ifndef OPS_PROTO_DEF_RELU6GRAD
48+#define OPS_PROTO_DEF_RELU6GRAD
47REG_OP(Relu6Grad)49REG_OP(Relu6Grad)
48 .INPUT(gradients, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))50 .INPUT(gradients, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))
49 .INPUT(features, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))51 .INPUT(features, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))
50 .OUTPUT(backprops, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))52 .OUTPUT(backprops, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))
51 .OP_END_FACTORY_REG(Relu6Grad)53 .OP_END_FACTORY_REG(Relu6Grad)
54+#endif // OPS_PROTO_DEF_RELU6GRAD
52 55 
53} // namespace ge56} // namespace ge
54 57 
@@ -35,12 +35,15 @@ namespace ge {
35 * @par Third-party framework compatibility35 * @par Third-party framework compatibility
36 * Compatible with the TensorFlow operator InplaceSub.36 * Compatible with the TensorFlow operator InplaceSub.
37 */37 */
38+#ifndef OPS_PROTO_DEF_INPLACESUB
39+#define OPS_PROTO_DEF_INPLACESUB
38REG_OP(InplaceSub)40REG_OP(InplaceSub)
39 .INPUT(x, TensorType::BasicType())41 .INPUT(x, TensorType::BasicType())
40 .INPUT(indices, TensorType({DT_INT32}))42 .INPUT(indices, TensorType({DT_INT32}))
41 .INPUT(v, TensorType::BasicType())43 .INPUT(v, TensorType::BasicType())
42 .OUTPUT(y, TensorType::BasicType())44 .OUTPUT(y, TensorType::BasicType())
43 .OP_END_FACTORY_REG(InplaceSub)45 .OP_END_FACTORY_REG(InplaceSub)
46+#endif // OPS_PROTO_DEF_INPLACESUB
44 47 
45} // namespace ge48} // namespace ge
46 49 
@@ -52,6 +52,8 @@ namespace ge {
52* Compatible with the PyTorch operator NonZeroWithValue.52* Compatible with the PyTorch operator NonZeroWithValue.
53*/53*/
54 54 
55+#ifndef OPS_PROTO_DEF_NONZEROWITHVALUE
56+#define OPS_PROTO_DEF_NONZEROWITHVALUE
55REG_OP(NonZeroWithValue)57REG_OP(NonZeroWithValue)
56 .INPUT(x, TensorType({DT_DOUBLE, DT_FLOAT, DT_FLOAT16, DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32, DT_UINT32,58 .INPUT(x, TensorType({DT_DOUBLE, DT_FLOAT, DT_FLOAT16, DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32, DT_UINT32,
57 DT_INT64, DT_UINT64, DT_BOOL}))59 DT_INT64, DT_UINT64, DT_BOOL}))
@@ -62,6 +64,7 @@ REG_OP(NonZeroWithValue)
62 .ATTR(transpose, Bool, false)64 .ATTR(transpose, Bool, false)
63 .ATTR(dtype, Type, DT_INT32)65 .ATTR(dtype, Type, DT_INT32)
64 .OP_END_FACTORY_REG(NonZeroWithValue)66 .OP_END_FACTORY_REG(NonZeroWithValue)
67+#endif // OPS_PROTO_DEF_NONZEROWITHVALUE
65 68 
66} // namespace ge69} // namespace ge
67 70 
@@ -36,6 +36,8 @@ namespace ge {
36* @par Third-party framework compatibility36* @par Third-party framework compatibility
37* Compatible with the mmcv operator chamfer_distance.37* Compatible with the mmcv operator chamfer_distance.
38*/38*/
39+#ifndef OPS_PROTO_DEF_CHAMFERDISTANCE
40+#define OPS_PROTO_DEF_CHAMFERDISTANCE
39REG_OP(ChamferDistance)41REG_OP(ChamferDistance)
40 .INPUT(xyz1, TensorType({DT_FLOAT, DT_BF16, DT_FLOAT16}))42 .INPUT(xyz1, TensorType({DT_FLOAT, DT_BF16, DT_FLOAT16}))
41 .INPUT(xyz2, TensorType({DT_FLOAT, DT_BF16, DT_FLOAT16}))43 .INPUT(xyz2, TensorType({DT_FLOAT, DT_BF16, DT_FLOAT16}))
@@ -44,6 +46,7 @@ REG_OP(ChamferDistance)
44 .OUTPUT(idx1, TensorType({DT_INT32}))46 .OUTPUT(idx1, TensorType({DT_INT32}))
45 .OUTPUT(idx2, TensorType({DT_INT32}))47 .OUTPUT(idx2, TensorType({DT_INT32}))
46 .OP_END_FACTORY_REG(ChamferDistance)48 .OP_END_FACTORY_REG(ChamferDistance)
49+#endif // OPS_PROTO_DEF_CHAMFERDISTANCE
47} // namespace ge50} // namespace ge
48 51 
49#endif // OPS_LOSS_CHAMFER_DISTANCE_PROTO_H_52#endif // OPS_LOSS_CHAMFER_DISTANCE_PROTO_H_
@@ -39,6 +39,8 @@ A2上支持8个,实际内部只支持3个
39* @par Third-party framework compatibility39* @par Third-party framework compatibility
40* Compatible with the PyTorch operator CosineEmbeddingLoss.40* Compatible with the PyTorch operator CosineEmbeddingLoss.
41*/41*/
42+#ifndef OPS_PROTO_DEF_COSINEEMBEDDINGLOSS
43+#define OPS_PROTO_DEF_COSINEEMBEDDINGLOSS
42REG_OP(CosineEmbeddingLoss)44REG_OP(CosineEmbeddingLoss)
43 .INPUT(x1, TensorType({DT_INT32, DT_FLOAT16, DT_FLOAT}))45 .INPUT(x1, TensorType({DT_INT32, DT_FLOAT16, DT_FLOAT}))
44 .INPUT(x2, TensorType({DT_INT32, DT_FLOAT16, DT_FLOAT}))46 .INPUT(x2, TensorType({DT_INT32, DT_FLOAT16, DT_FLOAT}))
@@ -47,5 +49,6 @@ REG_OP(CosineEmbeddingLoss)
47 .ATTR(reduction, String, "mean")49 .ATTR(reduction, String, "mean")
48 .OUTPUT(y, TensorType({DT_FLOAT}))50 .OUTPUT(y, TensorType({DT_FLOAT}))
49 .OP_END_FACTORY_REG(CosineEmbeddingLoss)51 .OP_END_FACTORY_REG(CosineEmbeddingLoss)
52+#endif // OPS_PROTO_DEF_COSINEEMBEDDINGLOSS
50} // namespace ge53} // namespace ge
51#endif // COSINE_EMBEDDING_LOSS_OP_PROTO_H_54#endif // COSINE_EMBEDDING_LOSS_OP_PROTO_H_
@@ -41,6 +41,8 @@ namespace ge {
41* @par Third-party framework compatibility41* @par Third-party framework compatibility
42* Compatible with pytorch MultiLabelMarginLoss operator42* Compatible with pytorch MultiLabelMarginLoss operator
43*/43*/
44+#ifndef OPS_PROTO_DEF_MULTILABELMARGINLOSS
45+#define OPS_PROTO_DEF_MULTILABELMARGINLOSS
44REG_OP(MultilabelMarginLoss)46REG_OP(MultilabelMarginLoss)
45 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))47 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
46 .INPUT(target, TensorType({DT_INT32}))48 .INPUT(target, TensorType({DT_INT32}))
@@ -48,6 +50,7 @@ REG_OP(MultilabelMarginLoss)
48 .OUTPUT(is_target, TensorType({DT_INT32}))50 .OUTPUT(is_target, TensorType({DT_INT32}))
49 .ATTR(reduction, String, "mean")51 .ATTR(reduction, String, "mean")
50 .OP_END_FACTORY_REG(MultilabelMarginLoss)52 .OP_END_FACTORY_REG(MultilabelMarginLoss)
53+#endif // OPS_PROTO_DEF_MULTILABELMARGINLOSS
51} // namespace ge54} // namespace ge
52 55 
53#endif // OPS_OP_PROTO_INC_MULTILABEL_MARGIN_LOSS_OPS_H_56#endif // OPS_OP_PROTO_INC_MULTILABEL_MARGIN_LOSS_OPS_H_
@@ -44,6 +44,8 @@ namespace ge {
44 * @par Third-party framework compatibility44 * @par Third-party framework compatibility
45 * Compatible with PyTorch operator PoissonNLLLoss.45 * Compatible with PyTorch operator PoissonNLLLoss.
46 */46 */
47+#ifndef OPS_PROTO_DEF_POISSONNLLLOSS
48+#define OPS_PROTO_DEF_POISSONNLLLOSS
47REG_OP(PoissonNllLoss)49REG_OP(PoissonNllLoss)
48 .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT}))50 .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT}))
49 .INPUT(target, TensorType({DT_FLOAT16, DT_FLOAT}))51 .INPUT(target, TensorType({DT_FLOAT16, DT_FLOAT}))
@@ -53,6 +55,7 @@ REG_OP(PoissonNllLoss)
53 .ATTR(eps, Float, 1e-8)55 .ATTR(eps, Float, 1e-8)
54 .ATTR(reduction, String, "mean")56 .ATTR(reduction, String, "mean")
55 .OP_END_FACTORY_REG(PoissonNllLoss)57 .OP_END_FACTORY_REG(PoissonNllLoss)
58+#endif // OPS_PROTO_DEF_POISSONNLLLOSS
56 59 
57} // namespace ge60} // namespace ge
58 61 
@@ -40,6 +40,8 @@ namespace ge {
40*y: A Tensor. Has the same type and shape as "pred". All elements within one row share the same40*y: A Tensor. Has the same type and shape as "pred". All elements within one row share the same
41*value, which is the focal loss of that row. \n41*value, which is the focal loss of that row. \n
42*/42*/
43+#ifndef OPS_PROTO_DEF_SOFTMAXFOCALLOSS
44+#define OPS_PROTO_DEF_SOFTMAXFOCALLOSS
43REG_OP(SoftmaxFocalLoss)45REG_OP(SoftmaxFocalLoss)
44 .INPUT(pred, TensorType({DT_FLOAT16, DT_FLOAT}))46 .INPUT(pred, TensorType({DT_FLOAT16, DT_FLOAT}))
45 .INPUT(target, TensorType({DT_INT32}))47 .INPUT(target, TensorType({DT_INT32}))
@@ -49,6 +51,7 @@ REG_OP(SoftmaxFocalLoss)
49 .ATTR(alpha, Float, 0.25)51 .ATTR(alpha, Float, 0.25)
50 .ATTR(reduction, String, "mean")52 .ATTR(reduction, String, "mean")
51 .OP_END_FACTORY_REG(SoftmaxFocalLoss)53 .OP_END_FACTORY_REG(SoftmaxFocalLoss)
54+#endif // OPS_PROTO_DEF_SOFTMAXFOCALLOSS
52 55 
53} // namespace ge56} // namespace ge
54 57 
@@ -40,6 +40,8 @@ namespace ge {
40*@par Outputs:40*@par Outputs:
41*grad: A Tensor. Has the same type and shape as "pred". \n41*grad: A Tensor. Has the same type and shape as "pred". \n
42*/42*/
43+#ifndef OPS_PROTO_DEF_SOFTMAXFOCALLOSSGRAD
44+#define OPS_PROTO_DEF_SOFTMAXFOCALLOSSGRAD
43REG_OP(SoftmaxFocalLossGrad)45REG_OP(SoftmaxFocalLossGrad)
44 .INPUT(pred, TensorType({DT_FLOAT16, DT_FLOAT}))46 .INPUT(pred, TensorType({DT_FLOAT16, DT_FLOAT}))
45 .INPUT(target, TensorType({DT_INT32}))47 .INPUT(target, TensorType({DT_INT32}))
@@ -50,6 +52,7 @@ REG_OP(SoftmaxFocalLossGrad)
50 .ATTR(alpha, Float, 0.25)52 .ATTR(alpha, Float, 0.25)
51 .ATTR(reduction, String, "mean")53 .ATTR(reduction, String, "mean")
52 .OP_END_FACTORY_REG(SoftmaxFocalLossGrad)54 .OP_END_FACTORY_REG(SoftmaxFocalLossGrad)
55+#endif // OPS_PROTO_DEF_SOFTMAXFOCALLOSSGRAD
53 56 
54} // namespace ge57} // namespace ge
55 58 
@@ -67,6 +67,8 @@ namespace ge {
67 * - Training mode: The saved inverse std (1/sqrt(epsilon + variance)).67 * - Training mode: The saved inverse std (1/sqrt(epsilon + variance)).
68 * - Inference mode: Same as input "input_variance".68 * - Inference mode: Same as input "input_variance".
69 */69 */
70+#ifndef OPS_PROTO_DEF_BATCHNORMEXT2
71+#define OPS_PROTO_DEF_BATCHNORMEXT2
70REG_OP(BatchNormExt2)72REG_OP(BatchNormExt2)
71 .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT}))73 .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT}))
72 .INPUT(input_scale, TensorType({DT_FLOAT}))74 .INPUT(input_scale, TensorType({DT_FLOAT}))
@@ -82,6 +84,7 @@ REG_OP(BatchNormExt2)
82 .ATTR(data_format, String, "NHWC")84 .ATTR(data_format, String, "NHWC")
83 .ATTR(is_training, Bool, true)85 .ATTR(is_training, Bool, true)
84 .OP_END_FACTORY_REG(BatchNormExt2)86 .OP_END_FACTORY_REG(BatchNormExt2)
87+#endif // OPS_PROTO_DEF_BATCHNORMEXT2
85} // namespace ge88} // namespace ge
86 89 
87#endif // OPS_NORM_BATCH_NORM_EXT2_PROTO_H_90#endif // OPS_NORM_BATCH_NORM_EXT2_PROTO_H_
@@ -54,6 +54,8 @@ channel.
54* @li For Atlas 200/300/500 Inference Product, the result accuracy fails to reach 1/1000 due to the square54* @li For Atlas 200/300/500 Inference Product, the result accuracy fails to reach 1/1000 due to the square
55* root instruction.55* root instruction.
56*/56*/
57+#ifndef OPS_PROTO_DEF_BN3DTRAININGUPDATE
58+#define OPS_PROTO_DEF_BN3DTRAININGUPDATE
57REG_OP(BN3DTrainingUpdate)59REG_OP(BN3DTrainingUpdate)
58 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))60 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))
59 .INPUT(sum, TensorType({DT_FLOAT}))61 .INPUT(sum, TensorType({DT_FLOAT}))
@@ -70,6 +72,7 @@ REG_OP(BN3DTrainingUpdate)
70 .OUTPUT(batch_mean, TensorType({DT_FLOAT}))72 .OUTPUT(batch_mean, TensorType({DT_FLOAT}))
71 .OUTPUT(batch_variance, TensorType({DT_FLOAT}))73 .OUTPUT(batch_variance, TensorType({DT_FLOAT}))
72 .OP_END_FACTORY_REG(BN3DTrainingUpdate)74 .OP_END_FACTORY_REG(BN3DTrainingUpdate)
75+#endif // OPS_PROTO_DEF_BN3DTRAININGUPDATE
73 76 
74} // namespace ge77} // namespace ge
75 78 
@@ -35,6 +35,8 @@ namespace ge {
35 * For Atlas 200/300/500 Inference Product, the result accuracy fails to reach 1/1000 due to the35 * For Atlas 200/300/500 Inference Product, the result accuracy fails to reach 1/1000 due to the
36 * square root instruction.36 * square root instruction.
37 */37 */
38+#ifndef OPS_PROTO_DEF_BNINFER
39+#define OPS_PROTO_DEF_BNINFER
38REG_OP(BNInfer)40REG_OP(BNInfer)
39 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))41 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))
40 .INPUT(scale, TensorType({DT_FLOAT}))42 .INPUT(scale, TensorType({DT_FLOAT}))
@@ -44,6 +46,7 @@ REG_OP(BNInfer)
44 .REQUIRED_ATTR(epsilon, Float)46 .REQUIRED_ATTR(epsilon, Float)
45 .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))47 .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))
46 .OP_END_FACTORY_REG(BNInfer)48 .OP_END_FACTORY_REG(BNInfer)
49+#endif // OPS_PROTO_DEF_BNINFER
47} // namespace ge50} // namespace ge
48 51 
49#endif // OPS_BUILT_IN_OP_PROTO_RUNTIME_BN_INFER_PROTO_H_52#endif // OPS_BUILT_IN_OP_PROTO_RUNTIME_BN_INFER_PROTO_H_
@@ -57,6 +57,8 @@ format as "x". \n
57* @li For Atlas 200/300/500 Inference Product, the result accuracy fails to reach 1/1000 due to57* @li For Atlas 200/300/500 Inference Product, the result accuracy fails to reach 1/1000 due to
58* the square root instruction.58* the square root instruction.
59*/59*/
60+#ifndef OPS_PROTO_DEF_BNTRAININGUPDATEV2
61+#define OPS_PROTO_DEF_BNTRAININGUPDATEV2
60REG_OP(BNTrainingUpdateV2)62REG_OP(BNTrainingUpdateV2)
61 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))63 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))
62 .INPUT(sum, TensorType({DT_FLOAT}))64 .INPUT(sum, TensorType({DT_FLOAT}))
@@ -68,6 +70,7 @@ REG_OP(BNTrainingUpdateV2)
68 .OUTPUT(batch_mean, TensorType({DT_FLOAT}))70 .OUTPUT(batch_mean, TensorType({DT_FLOAT}))
69 .OUTPUT(batch_variance, TensorType({DT_FLOAT}))71 .OUTPUT(batch_variance, TensorType({DT_FLOAT}))
70 .OP_END_FACTORY_REG(BNTrainingUpdateV2)72 .OP_END_FACTORY_REG(BNTrainingUpdateV2)
73+#endif // OPS_PROTO_DEF_BNTRAININGUPDATEV2
71 74 
72} // namespace ge75} // namespace ge
73 76 
@@ -61,6 +61,8 @@ format as "x".
61* @li For Atlas 200/300/500 Inference Product, the result accuracy fails to reach 1/1000 due to61* @li For Atlas 200/300/500 Inference Product, the result accuracy fails to reach 1/1000 due to
62* the square root instruction.62* the square root instruction.
63*/63*/
64+#ifndef OPS_PROTO_DEF_BNTRAININGUPDATEV3
65+#define OPS_PROTO_DEF_BNTRAININGUPDATEV3
64REG_OP(BNTrainingUpdateV3)66REG_OP(BNTrainingUpdateV3)
65 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))67 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16}))
66 .INPUT(sum, TensorType({DT_FLOAT}))68 .INPUT(sum, TensorType({DT_FLOAT}))
@@ -74,6 +76,7 @@ REG_OP(BNTrainingUpdateV3)
74 .OUTPUT(reserve_1, TensorType({DT_FLOAT}))76 .OUTPUT(reserve_1, TensorType({DT_FLOAT}))
75 .OUTPUT(reserve_2, TensorType({DT_FLOAT}))77 .OUTPUT(reserve_2, TensorType({DT_FLOAT}))
76 .OP_END_FACTORY_REG(BNTrainingUpdateV3)78 .OP_END_FACTORY_REG(BNTrainingUpdateV3)
79+#endif // OPS_PROTO_DEF_BNTRAININGUPDATEV3
77 80 
78} // namespace ge81} // namespace ge
79 82 
@@ -41,6 +41,8 @@ namespace ge {
41 * @li rstd: A Tensor. Support dtype: [float32], support format: [ND].41 * @li rstd: A Tensor. Support dtype: [float32], support format: [ND].
42 * @li y: A Tensor. Support dtype: [float32, float16, bfloat16], support format: [ND].42 * @li y: A Tensor. Support dtype: [float32, float16, bfloat16], support format: [ND].
43 */43 */
44+#ifndef OPS_PROTO_DEF_DEEPNORM
45+#define OPS_PROTO_DEF_DEEPNORM
44REG_OP(DeepNorm)46REG_OP(DeepNorm)
45 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))47 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
46 .INPUT(gx, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))48 .INPUT(gx, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
@@ -52,6 +54,7 @@ REG_OP(DeepNorm)
52 .ATTR(alpha, Float, 0.3f)54 .ATTR(alpha, Float, 0.3f)
53 .ATTR(epsilon, Float, 1e-06f)55 .ATTR(epsilon, Float, 1e-06f)
54 .OP_END_FACTORY_REG(DeepNorm);56 .OP_END_FACTORY_REG(DeepNorm);
57+#endif // OPS_PROTO_DEF_DEEPNORM
55} // namespace ge58} // namespace ge
56 59 
57-#endif // OPS_NORM_DEEP_NORM_PROTO_H_60+#endif // OPS_NORM_DEEP_NORM_PROTO_H_
@@ -38,6 +38,8 @@ namespace ge {
38 * @li dbeta: A Tensor. Support dtype: [float32], support format: [ND].38 * @li dbeta: A Tensor. Support dtype: [float32], support format: [ND].
39 * @li dgamma: A Tensor. Support dtype: [float32], support format: [ND].39 * @li dgamma: A Tensor. Support dtype: [float32], support format: [ND].
40 */40 */
41+#ifndef OPS_PROTO_DEF_DEEPNORMGRAD
42+#define OPS_PROTO_DEF_DEEPNORMGRAD
41REG_OP(DeepNormGrad)43REG_OP(DeepNormGrad)
42 .INPUT(dy, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))44 .INPUT(dy, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
43 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))45 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
@@ -51,5 +53,6 @@ REG_OP(DeepNormGrad)
51 .OUTPUT(dgamma, TensorType({DT_FLOAT}))53 .OUTPUT(dgamma, TensorType({DT_FLOAT}))
52 .ATTR(alpha, Float, 0.3f)54 .ATTR(alpha, Float, 0.3f)
53 .OP_END_FACTORY_REG(DeepNormGrad);55 .OP_END_FACTORY_REG(DeepNormGrad);
56+#endif // OPS_PROTO_DEF_DEEPNORMGRAD
54} // namespace ge57} // namespace ge
55-#endif // OPS_BUILT_IN_OP_PROTO_INC_DEEP_NORM_GRAD_OPS_H_58+#endif // OPS_BUILT_IN_OP_PROTO_INC_DEEP_NORM_GRAD_OPS_H_
@@ -45,6 +45,8 @@ namespace ge {
45* The first several dimensions refer to the dimension of "x" minus the dimension of "gamma",45* The first several dimensions refer to the dimension of "x" minus the dimension of "gamma",
46* indicating that the norm is not required.46* indicating that the norm is not required.
47*/47*/
48+#ifndef OPS_PROTO_DEF_GEMMARMSNORM
49+#define OPS_PROTO_DEF_GEMMARMSNORM
48REG_OP(GemmaRmsNorm)50REG_OP(GemmaRmsNorm)
49 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))51 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
50 .INPUT(gamma, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))52 .INPUT(gamma, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
@@ -52,5 +54,6 @@ REG_OP(GemmaRmsNorm)
52 .OUTPUT(rstd, TensorType({DT_FLOAT, DT_FLOAT, DT_FLOAT}))54 .OUTPUT(rstd, TensorType({DT_FLOAT, DT_FLOAT, DT_FLOAT}))
53 .ATTR(epsilon, Float, 1e-6f)55 .ATTR(epsilon, Float, 1e-6f)
54 .OP_END_FACTORY_REG(GemmaRmsNorm)56 .OP_END_FACTORY_REG(GemmaRmsNorm)
57+#endif // OPS_PROTO_DEF_GEMMARMSNORM
55} // namespace ge58} // namespace ge
56-#endif // OPS_BUILT_IN_OP_PROTO_INC_GEMMA_RMS_NORM_OPS_H_59+#endif // OPS_BUILT_IN_OP_PROTO_INC_GEMMA_RMS_NORM_OPS_H_
@@ -43,6 +43,8 @@ namespace ge {
43 * @par Third-party framework compatibility43 * @par Third-party framework compatibility
44 * It is a custom operator. It has no corresponding operator in Caffe, ONNX, TensorFlow, or PyTorch.44 * It is a custom operator. It has no corresponding operator in Caffe, ONNX, TensorFlow, or PyTorch.
45 */45 */
46+#ifndef OPS_PROTO_DEF_GROUPNORMSILUQUANT
47+#define OPS_PROTO_DEF_GROUPNORMSILUQUANT
46REG_OP(GroupNormSiluQuant)48REG_OP(GroupNormSiluQuant)
47 .INPUT(x, TensorType({DT_BF16, DT_FLOAT16}))49 .INPUT(x, TensorType({DT_BF16, DT_FLOAT16}))
48 .OPTIONAL_INPUT(gamma, TensorType({DT_BF16, DT_FLOAT16}))50 .OPTIONAL_INPUT(gamma, TensorType({DT_BF16, DT_FLOAT16}))
@@ -55,6 +57,7 @@ REG_OP(GroupNormSiluQuant)
55 .ATTR(eps, Float, 0.00001f)57 .ATTR(eps, Float, 0.00001f)
56 .ATTR(activate_silu, Bool, true)58 .ATTR(activate_silu, Bool, true)
57 .OP_END_FACTORY_REG(GroupNormSiluQuant)59 .OP_END_FACTORY_REG(GroupNormSiluQuant)
60+#endif // OPS_PROTO_DEF_GROUPNORMSILUQUANT
58 61 
59} // namespace ge62} // namespace ge
60 63 
@@ -44,6 +44,8 @@ Defaults to "0.00001" . \n
44*@attention Constraints:44*@attention Constraints:
45*For Atlas 200/300/500 Inference Product, the result accuracy fails to reach 0.001 due to the square root instruction.45*For Atlas 200/300/500 Inference Product, the result accuracy fails to reach 0.001 due to the square root instruction.
46*/46*/
47+#ifndef OPS_PROTO_DEF_ININFERV2
48+#define OPS_PROTO_DEF_ININFERV2
47REG_OP(INInferV2)49REG_OP(INInferV2)
48 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))50 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
49 .OPTIONAL_INPUT(gamma, TensorType({DT_FLOAT}))51 .OPTIONAL_INPUT(gamma, TensorType({DT_FLOAT}))
@@ -55,6 +57,7 @@ REG_OP(INInferV2)
55 .OUTPUT(batch_mean, TensorType({DT_FLOAT}))57 .OUTPUT(batch_mean, TensorType({DT_FLOAT}))
56 .OUTPUT(batch_variance, TensorType({DT_FLOAT}))58 .OUTPUT(batch_variance, TensorType({DT_FLOAT}))
57 .OP_END_FACTORY_REG(INInferV2)59 .OP_END_FACTORY_REG(INInferV2)
60+#endif // OPS_PROTO_DEF_ININFERV2
58 61 
59} // namespace ge62} // namespace ge
60 63 
@@ -40,6 +40,8 @@ namespace ge {
40* @attention The epsilon added to variance is a compile-time constant 1e-6 (not an attribute).40* @attention The epsilon added to variance is a compile-time constant 1e-6 (not an attribute).
41*/41*/
42 42 
43+#ifndef OPS_PROTO_DEF_INTRAININGUPDATEGRAD
44+#define OPS_PROTO_DEF_INTRAININGUPDATEGRAD
43REG_OP(INTrainingUpdateGrad)45REG_OP(INTrainingUpdateGrad)
44 .INPUT(dy, TensorType({DT_FLOAT16, DT_FLOAT}))46 .INPUT(dy, TensorType({DT_FLOAT16, DT_FLOAT}))
45 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))47 .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
@@ -48,6 +50,7 @@ REG_OP(INTrainingUpdateGrad)
48 .OUTPUT(res_gamma, TensorType({DT_FLOAT}))50 .OUTPUT(res_gamma, TensorType({DT_FLOAT}))
49 .OUTPUT(res_beta, TensorType({DT_FLOAT}))51 .OUTPUT(res_beta, TensorType({DT_FLOAT}))
50 .OP_END_FACTORY_REG(INTrainingUpdateGrad)52 .OP_END_FACTORY_REG(INTrainingUpdateGrad)
53+#endif // OPS_PROTO_DEF_INTRAININGUPDATEGRAD
51} // namespace ge54} // namespace ge
52 55 
53#endif // OPS_NORM_IN_TRAINING_UPDATE_GRAD_PROTO_H_56#endif // OPS_NORM_IN_TRAINING_UPDATE_GRAD_PROTO_H_
@@ -44,6 +44,8 @@ namespace ge {
44 * @par Third-party framework compatibility44 * @par Third-party framework compatibility
45 * @li Compatible with the backward of the TensorFlow operator InstanceNormGrad.45 * @li Compatible with the backward of the TensorFlow operator InstanceNormGrad.
46 */46 */
47+#ifndef OPS_PROTO_DEF_INSTANCENORMGRAD
48+#define OPS_PROTO_DEF_INSTANCENORMGRAD
47REG_OP(InstanceNormGrad)49REG_OP(InstanceNormGrad)
48 .INPUT(dy, TensorType({DT_FLOAT, DT_FLOAT16}))50 .INPUT(dy, TensorType({DT_FLOAT, DT_FLOAT16}))
49 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16}))51 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16}))
@@ -54,5 +56,6 @@ REG_OP(InstanceNormGrad)
54 .OUTPUT(pd_gamma, TensorType({DT_FLOAT, DT_FLOAT16}))56 .OUTPUT(pd_gamma, TensorType({DT_FLOAT, DT_FLOAT16}))
55 .OUTPUT(pd_beta, TensorType({DT_FLOAT, DT_FLOAT16}))57 .OUTPUT(pd_beta, TensorType({DT_FLOAT, DT_FLOAT16}))
56 .OP_END_FACTORY_REG(InstanceNormGrad)58 .OP_END_FACTORY_REG(InstanceNormGrad)
59+#endif // OPS_PROTO_DEF_INSTANCENORMGRAD
57} // namespace ge60} // namespace ge
58#endif // OPS_BUILT_IN_OP_PROTO_INC_INSTANCE_NORM_GRAD_OPS_H_61#endif // OPS_BUILT_IN_OP_PROTO_INC_INSTANCE_NORM_GRAD_OPS_H_
@@ -42,6 +42,8 @@ namespace ge {
42 * @par Third-party framework compatibility42 * @par Third-party framework compatibility
43 * Compatible with the L2 scenario of the PyTorch operator NormalizeGrad.43 * Compatible with the L2 scenario of the PyTorch operator NormalizeGrad.
44 */44 */
45+#ifndef OPS_PROTO_DEF_L2NORMALIZEGRAD
46+#define OPS_PROTO_DEF_L2NORMALIZEGRAD
45REG_OP(L2NormalizeGrad)47REG_OP(L2NormalizeGrad)
46 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16}))48 .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16}))
47 .INPUT(y, TensorType({DT_FLOAT, DT_FLOAT16}))49 .INPUT(y, TensorType({DT_FLOAT, DT_FLOAT16}))
@@ -50,6 +52,7 @@ REG_OP(L2NormalizeGrad)
50 .ATTR(dim, ListInt, {1})52 .ATTR(dim, ListInt, {1})
51 .ATTR(eps, Float, 0.0001f)53 .ATTR(eps, Float, 0.0001f)
52 .OP_END_FACTORY_REG(L2NormalizeGrad)54 .OP_END_FACTORY_REG(L2NormalizeGrad)
55+#endif // OPS_PROTO_DEF_L2NORMALIZEGRAD
53 56 
54} // namespace ge57} // namespace ge
55#endif // OPS_NORM_L2_NORMALIZE_GRAD_PROTO_H_58#endif // OPS_NORM_L2_NORMALIZE_GRAD_PROTO_H_
@@ -67,6 +67,8 @@ namespace ge {
67* @li scale2: A tensor. Describing of the factor for the second dynamic quantization.67* @li scale2: A tensor. Describing of the factor for the second dynamic quantization.
68* Support dtype: float32, support format: ND.68* Support dtype: float32, support format: ND.
69*/69*/
70+#ifndef OPS_PROTO_DEF_MULTIADDRMSNORMDYNAMICQUANT
71+#define OPS_PROTO_DEF_MULTIADDRMSNORMDYNAMICQUANT
70REG_OP(MultiAddRmsNormDynamicQuant)72REG_OP(MultiAddRmsNormDynamicQuant)
71 .DYNAMIC_INPUT(x1, TensorType({DT_FLOAT16, DT_BF16}))73 .DYNAMIC_INPUT(x1, TensorType({DT_FLOAT16, DT_BF16}))
72 .INPUT(x2, TensorType({DT_FLOAT16, DT_BF16}))74 .INPUT(x2, TensorType({DT_FLOAT16, DT_BF16}))
@@ -81,6 +83,7 @@ REG_OP(MultiAddRmsNormDynamicQuant)
81 .OUTPUT(scale2, TensorType({DT_FLOAT}))83 .OUTPUT(scale2, TensorType({DT_FLOAT}))
82 .ATTR(epsilon, Float, 1e-6)84 .ATTR(epsilon, Float, 1e-6)
83 .OP_END_FACTORY_REG(MultiAddRmsNormDynamicQuant)85 .OP_END_FACTORY_REG(MultiAddRmsNormDynamicQuant)
86+#endif // OPS_PROTO_DEF_MULTIADDRMSNORMDYNAMICQUANT
84} // namespace ge87} // namespace ge
85 88 
86-#endif // OPS_NORM_MULTI_ADD_RMS_NORM_DYNAMIC_QUANT_OP_GRAPH_H_89+#endif // OPS_NORM_MULTI_ADD_RMS_NORM_DYNAMIC_QUANT_OP_GRAPH_H_
@@ -46,6 +46,8 @@ namespace ge {
46 *Compatible with the TensorFlow operator ApplyAdagrad.46 *Compatible with the TensorFlow operator ApplyAdagrad.
47 *47 *
48 */48 */
49+#ifndef OPS_PROTO_DEF_APPLYADAGRAD
50+#define OPS_PROTO_DEF_APPLYADAGRAD
49REG_OP(ApplyAdagrad)51REG_OP(ApplyAdagrad)
50 .INPUT(var, TensorType::NumberType())52 .INPUT(var, TensorType::NumberType())
51 .INPUT(accum, TensorType::NumberType())53 .INPUT(accum, TensorType::NumberType())
@@ -55,5 +57,6 @@ REG_OP(ApplyAdagrad)
55 .ATTR(update_slots, Bool, true)57 .ATTR(update_slots, Bool, true)
56 .ATTR(use_locking, Bool, false)58 .ATTR(use_locking, Bool, false)
57 .OP_END_FACTORY_REG(ApplyAdagrad)59 .OP_END_FACTORY_REG(ApplyAdagrad)
60+#endif // OPS_PROTO_DEF_APPLYADAGRAD
58} // namespace ge61} // namespace ge
59#endif // OPS_NN_APPLY_ADAGRAD_PROTO_H62#endif // OPS_NN_APPLY_ADAGRAD_PROTO_H
@@ -59,6 +59,8 @@ namespace ge {
59 * Compatible with the RMSProp state-update semantics used by the training59 * Compatible with the RMSProp state-update semantics used by the training
60 * optimizer family. Framework adapters must preserve all three outputs.60 * optimizer family. Framework adapters must preserve all three outputs.
61 */61 */
62+#ifndef OPS_PROTO_DEF_INPLACEAPPLYRMSPROP
63+#define OPS_PROTO_DEF_INPLACEAPPLYRMSPROP
62REG_OP(InplaceApplyRMSProp)64REG_OP(InplaceApplyRMSProp)
63 .INPUT(var, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))65 .INPUT(var, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
64 .INPUT(ms, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))66 .INPUT(ms, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
@@ -73,6 +75,7 @@ REG_OP(InplaceApplyRMSProp)
73 .OUTPUT(mom, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))75 .OUTPUT(mom, TensorType({DT_FLOAT, DT_FLOAT16, DT_BF16}))
74 .ATTR(use_locking, Bool, false)76 .ATTR(use_locking, Bool, false)
75 .OP_END_FACTORY_REG(InplaceApplyRMSProp)77 .OP_END_FACTORY_REG(InplaceApplyRMSProp)
78+#endif // OPS_PROTO_DEF_INPLACEAPPLYRMSPROP
76 79 
77} // namespace ge80} // namespace ge
78 81 
@@ -46,6 +46,8 @@ namespace ge {
46* @par Third-party framework compatibility46* @par Third-party framework compatibility
47* Compatible with the Mindspore operator Scatter.47* Compatible with the Mindspore operator Scatter.
48*/48*/
49+#ifndef OPS_PROTO_DEF_DYNAMICQUANTUPDATESCATTER
50+#define OPS_PROTO_DEF_DYNAMICQUANTUPDATESCATTER
49REG_OP(DynamicQuantUpdateScatter)51REG_OP(DynamicQuantUpdateScatter)
50 .INPUT(var, TensorType({DT_INT8}))52 .INPUT(var, TensorType({DT_INT8}))
51 .INPUT(var_scale, TensorType({DT_FLOAT}))53 .INPUT(var_scale, TensorType({DT_FLOAT}))
@@ -57,6 +59,7 @@ REG_OP(DynamicQuantUpdateScatter)
57 .REQUIRED_ATTR(reduce, String)59 .REQUIRED_ATTR(reduce, String)
58 .ATTR(axis, Int, 0)60 .ATTR(axis, Int, 0)
59 .OP_END_FACTORY_REG(DynamicQuantUpdateScatter)61 .OP_END_FACTORY_REG(DynamicQuantUpdateScatter)
62+#endif // OPS_PROTO_DEF_DYNAMICQUANTUPDATESCATTER
60 63 
61} // namespace ge64} // namespace ge
62 65 
@@ -41,6 +41,8 @@ namespace ge {
41* @li var_offset: A tensor with shape (1, B, S). Result tensor after an in-place scatter.41* @li var_offset: A tensor with shape (1, B, S). Result tensor after an in-place scatter.
42* The type support float32, format support ND.42* The type support float32, format support ND.
43*/43*/
44+#ifndef OPS_PROTO_DEF_DYNAMICQUANTUPDATESCATTERV2
45+#define OPS_PROTO_DEF_DYNAMICQUANTUPDATESCATTERV2
44REG_OP(DynamicQuantUpdateScatterV2)46REG_OP(DynamicQuantUpdateScatterV2)
45 .INPUT(x, TensorType({DT_FLOAT16, DT_BF16}))47 .INPUT(x, TensorType({DT_FLOAT16, DT_BF16}))
46 .INPUT(indices, TensorType({DT_INT32}))48 .INPUT(indices, TensorType({DT_INT32}))
@@ -51,7 +53,8 @@ REG_OP(DynamicQuantUpdateScatterV2)
51 .OUTPUT(var_scale, TensorType({DT_FLOAT}))53 .OUTPUT(var_scale, TensorType({DT_FLOAT}))
52 .OUTPUT(var_offset, TensorType({DT_FLOAT}))54 .OUTPUT(var_offset, TensorType({DT_FLOAT}))
53 .OP_END_FACTORY_REG(DynamicQuantUpdateScatterV2)55 .OP_END_FACTORY_REG(DynamicQuantUpdateScatterV2)
56+#endif // OPS_PROTO_DEF_DYNAMICQUANTUPDATESCATTERV2
54 57 
55} // namespace ge58} // namespace ge
56 59 
57-#endif // OPS_OP_PROTO_INC_DYNAMIC_QUANT_UPDATE_SCATTER_V2_H_60+#endif // OPS_OP_PROTO_INC_DYNAMIC_QUANT_UPDATE_SCATTER_V2_H_