已合并
修复SeluGrad、ApplyAddSign、SoftMarginLossGrad算子原型重复问题 #8552
yulianjie创建于 8月11日
修复SeluGrad、ApplyAddSign、SoftMarginLossGrad算子原型重复问题 #8552
已合并
共 3 个文件变更+41-32
| @@ -38,10 +38,13 @@ namespace ge { | |||
| 38 | * @par Third-party framework compatibility | 38 | * @par Third-party framework compatibility |
| 39 | * @li Compatible with the Pytorch operator selu_backward. | 39 | * @li Compatible with the Pytorch operator selu_backward. |
| 40 | */ | 40 | */ |
| 41 | + | ||
| 42 | + | ||
| 41 | REG_OP(SeluGrad) | 43 | REG_OP(SeluGrad) |
| 42 | .INPUT(gradients, TensorType::RealNumberType()) | 44 | .INPUT(gradients, TensorType::RealNumberType()) |
| 43 | .INPUT(outputs, TensorType::RealNumberType()) | 45 | .INPUT(outputs, TensorType::RealNumberType()) |
| 44 | .OUTPUT(y, TensorType::RealNumberType()) | 46 | .OUTPUT(y, TensorType::RealNumberType()) |
| 45 | .OP_END_FACTORY_REG(SeluGrad) | 47 | .OP_END_FACTORY_REG(SeluGrad) |
| 48 | + | ||
| 46 | } // namespace ge | 49 | } // namespace ge |
| 47 | 50 | ||
| @@ -107,42 +107,44 @@ REG_OP(AdaptiveMaxPool2d) | |||
| 107 | .ATTR(use_locking, Bool, false) | 107 | .ATTR(use_locking, Bool, false) |
| 108 | .OP_END_FACTORY_REG(ApplyAdamWithAmsgradV2) | 108 | .OP_END_FACTORY_REG(ApplyAdamWithAmsgradV2) |
| 109 | 109 | ||
| 110 | - /** | 110 | +/** |
| 111 | - *@brief Updates "var" according to the AddSign update . \n | 111 | +*@brief Updates "var" according to the AddSign update . \n |
| 112 | 112 | ||
| 113 | - *@par Inputs: | 113 | +*@par Inputs: |
| 114 | - *Seven inputs, including: | 114 | +*Seven inputs, including: |
| 115 | - * @li var: A ND Tensor of type TensorType::NumberType(). | 115 | +* @li var: A ND Tensor of type TensorType::NumberType(). |
| 116 | - * @li m: A ND Tensor of the same type as "var". | 116 | +* @li m: A ND Tensor of the same type as "var". |
| 117 | - * @li lr: A Tensor of the same type as "var", for the scaling factor. Must be a scalar. | 117 | +* @li lr: A Tensor of the same type as "var", for the scaling factor. Must be a scalar. |
| 118 | - * Support Dimension: 1D. | 118 | +* Support Dimension: 1D. |
| 119 | - * Support format: ND. | 119 | +* Support format: ND. |
| 120 | - * @li alpha: A Tensor of the same type as "var". Must be a scalar. | 120 | +* @li alpha: A Tensor of the same type as "var". Must be a scalar. |
| 121 | - * Support Dimension: 1D. | 121 | +* Support Dimension: 1D. |
| 122 | - * Support format: ND. | 122 | +* Support format: ND. |
| 123 | - * @li sign_decay: A Tensor of the same type as "var". Must be a scalar. | 123 | +* @li sign_decay: A Tensor of the same type as "var". Must be a scalar. |
| 124 | - * Support Dimension: 1D. | 124 | +* Support Dimension: 1D. |
| 125 | - * Support format: ND. | 125 | +* Support format: ND. |
| 126 | - * @li beta: A Tensor of the same type as "var". Must be a scalar. | 126 | +* @li beta: A Tensor of the same type as "var". Must be a scalar. |
| 127 | - * Support Dimension: 1D. | 127 | +* Support Dimension: 1D. |
| 128 | - * Support format: ND. | 128 | +* Support format: ND. |
| 129 | - * @li grad: A Tensor of the same type as "var", for the gradient. | 129 | +* @li grad: A Tensor of the same type as "var", for the gradient. |
| 130 | - * Support format: ND. | 130 | +* Support format: ND. |
| 131 | - * Support Dimension: 2D. | 131 | +* Support Dimension: 2D. |
| 132 | 132 | ||
| 133 | - *@par Attributes: | 133 | +*@par Attributes: |
| 134 | - *use_locking: An optional bool. Defaults to "False". | 134 | +*use_locking: An optional bool. Defaults to "False". |
| 135 | - * If "True", updating of the "var" and "m" tensors will be | 135 | +* If "True", updating of the "var" and "m" tensors will be |
| 136 | - * protected by a lock; otherwise the behavior is undefined, | 136 | +* protected by a lock; otherwise the behavior is undefined, |
| 137 | - * but may exhibit less contention . \n | 137 | +* but may exhibit less contention . \n |
| 138 | 138 | ||
| 139 | - *@par Outputs: | 139 | +*@par Outputs: |
| 140 | - *var: A ND Tensor. Has the same type and shape with "var" . \n | 140 | +*var: A ND Tensor. Has the same type and shape with "var" . \n |
| 141 | 141 | ||
| 142 | - *@par Third-party framework compatibility | 142 | +*@par Third-party framework compatibility |
| 143 | - * Compatible with the TensorFlow operator ApplyAddSign. | 143 | +* Compatible with the TensorFlow operator ApplyAddSign. |
| 144 | - */ | 144 | +*/ |
| 145 | - REG_OP(ApplyAddSign) | 145 | +#ifndef OPS_PROTO_DEF_APPLYADDSIGN |
| 146 | + | ||
| 147 | + REG_OP(ApplyAddSign) | ||
| 146 | .INPUT(var, TensorType::NumberType()) | 148 | .INPUT(var, TensorType::NumberType()) |
| 147 | .INPUT(m, TensorType::NumberType()) | 149 | .INPUT(m, TensorType::NumberType()) |
| 148 | .INPUT(lr, TensorType::NumberType()) | 150 | .INPUT(lr, TensorType::NumberType()) |
| @@ -153,6 +155,7 @@ REG_OP(AdaptiveMaxPool2d) | |||
| 153 | .OUTPUT(var, TensorType::NumberType()) | 155 | .OUTPUT(var, TensorType::NumberType()) |
| 154 | .ATTR(use_locking, Bool, false) | 156 | .ATTR(use_locking, Bool, false) |
| 155 | .OP_END_FACTORY_REG(ApplyAddSign) | 157 | .OP_END_FACTORY_REG(ApplyAddSign) |
| 158 | + | ||
| 156 | 159 | ||
| 157 | /** | 160 | /** |
| 158 | * @brief Anti quantizes the input . \n | 161 | * @brief Anti quantizes the input . \n |
| @@ -32,6 +32,8 @@ namespace ge { | |||
| 32 | *@par Outputs: | 32 | *@par Outputs: |
| 33 | * out: broadcast(self, target, grad_output), same dtype. | 33 | * out: broadcast(self, target, grad_output), same dtype. |
| 34 | */ | 34 | */ |
| 35 | + | ||
| 36 | + | ||
| 35 | REG_OP(SoftMarginLossGrad) | 37 | REG_OP(SoftMarginLossGrad) |
| 36 | .INPUT(predict, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16})) | 38 | .INPUT(predict, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16})) |
| 37 | .INPUT(label, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16})) | 39 | .INPUT(label, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16})) |
| @@ -39,6 +41,7 @@ REG_OP(SoftMarginLossGrad) | |||
| 39 | .OUTPUT(gradient, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16})) | 41 | .OUTPUT(gradient, TensorType({DT_FLOAT16, DT_FLOAT, DT_BF16})) |
| 40 | .ATTR(reduction, String, "mean") | 42 | .ATTR(reduction, String, "mean") |
| 41 | .OP_END_FACTORY_REG(SoftMarginLossGrad) | 43 | .OP_END_FACTORY_REG(SoftMarginLossGrad) |
| 44 | + | ||
| 42 | 45 | ||
| 43 | } // namespace ge | 46 | } // namespace ge |
| 44 | 47 | ||