diff --git a/mindspore/ccsrc/transform/graph_ir/op_declare/math_ops_declare.cc b/mindspore/ccsrc/transform/graph_ir/op_declare/math_ops_declare.cc index b2c04747c30..cf6a70d8a1a 100644 --- a/mindspore/ccsrc/transform/graph_ir/op_declare/math_ops_declare.cc +++ b/mindspore/ccsrc/transform/graph_ir/op_declare/math_ops_declare.cc @@ -128,4 +128,45 @@ INPUT_MAP(Trunc) = {{1, INPUT_DESC(input_x)}}; ATTR_MAP(Trunc) = EMPTY_ATTR_MAP; OUTPUT_MAP(Trunc) = {{0, OUTPUT_DESC(output_y)}}; REG_ADPT_DESC(Trunc, prim::kPrimTrunc->name(), ADPT_DESC(Trunc)) + +// HistogramFixedWidth +INPUT_MAP(HistogramFixedWidth) = {{1, INPUT_DESC(x)}, {2, INPUT_DESC(range)}, {3, INPUT_DESC(nbins)}}; +ATTR_MAP(HistogramFixedWidth) = { + {"dtype", ATTR_DESC(dtype, AnyTraits())}, +}; +ATTR_INPUT_MAP(HistogramFixedWidth) = {{"nbins", 3}}; +OUTPUT_MAP(HistogramFixedWidth) = {{0, OUTPUT_DESC(y)}}; +REG_ADPT_DESC(HistogramFixedWidth, kHistogramFixedWidthDOpName, ADPT_DESC(HistogramFixedWidth)) + +// Pdist +INPUT_MAP(Pdist) = {{1, INPUT_DESC(x)}}; +ATTR_MAP(Pdist) = { + {"p", ATTR_DESC(p, AnyTraits())}, +}; +OUTPUT_MAP(Pdist) = {{0, OUTPUT_DESC(y)}}; +REG_ADPT_DESC(Pdist, prim::kPrimPdist->name(), ADPT_DESC(Pdist)) + +// SoftMarginLossGrad +INPUT_MAP(SoftMarginLossGrad) = {{1, INPUT_DESC(predict)}, {2, INPUT_DESC(label)}, {3, INPUT_DESC(dout)}}; +ATTR_MAP(SoftMarginLossGrad) = { + {"reduction", ATTR_DESC(reduction, AnyTraits())}, +}; +OUTPUT_MAP(SoftMarginLossGrad) = {{0, OUTPUT_DESC(gradient)}}; +REG_ADPT_DESC(SoftMarginLossGrad, prim::kPrimSoftMarginLossGrad->name(), ADPT_DESC(SoftMarginLossGrad)) + +// Cdist +INPUT_MAP(Cdist) = {{1, INPUT_DESC(x1)}, {2, INPUT_DESC(x2)}}; +ATTR_MAP(Cdist) = { + {"p", ATTR_DESC(p, AnyTraits())}, +}; +OUTPUT_MAP(Cdist) = {{0, OUTPUT_DESC(y)}}; +REG_ADPT_DESC(Cdist, prim::kPrimCdist->name(), ADPT_DESC(Cdist)) + +// CdistGrad +INPUT_MAP(CdistGrad) = {{1, INPUT_DESC(grad)}, {2, INPUT_DESC(x1)}, {3, INPUT_DESC(x2)}, {4, INPUT_DESC(cdist)}}; +ATTR_MAP(CdistGrad) = { + {"p", ATTR_DESC(p, AnyTraits())}, +}; +OUTPUT_MAP(CdistGrad) = {{0, OUTPUT_DESC(y)}}; +REG_ADPT_DESC(CdistGrad, prim::kPrimCdistGrad->name(), ADPT_DESC(CdistGrad)) } // namespace mindspore::transform diff --git a/mindspore/ccsrc/transform/graph_ir/op_declare/math_ops_declare.h b/mindspore/ccsrc/transform/graph_ir/op_declare/math_ops_declare.h index eb4d69fa722..e68ffc36061 100644 --- a/mindspore/ccsrc/transform/graph_ir/op_declare/math_ops_declare.h +++ b/mindspore/ccsrc/transform/graph_ir/op_declare/math_ops_declare.h @@ -19,6 +19,7 @@ #include "utils/hash_map.h" #include "transform/graph_ir/op_declare/op_declare_macro.h" +#include "mindspore/ccsrc/include/common/utils/utils.h" #include "ops/math_ops.h" namespace mindspore::transform { @@ -66,5 +67,20 @@ DECLARE_OP_USE_OUTPUT(LpNorm) DECLARE_OP_ADAPTER(Trunc) DECLARE_OP_USE_OUTPUT(Trunc) + +DECLARE_OP_ADAPTER(HistogramFixedWidth) +DECLARE_OP_USE_OUTPUT(HistogramFixedWidth) + +DECLARE_OP_ADAPTER(Pdist) +DECLARE_OP_USE_OUTPUT(Pdist) + +DECLARE_OP_ADAPTER(SoftMarginLossGrad) +DECLARE_OP_USE_OUTPUT(SoftMarginLossGrad) + +DECLARE_OP_ADAPTER(Cdist) +DECLARE_OP_USE_OUTPUT(Cdist) + +DECLARE_OP_ADAPTER(CdistGrad) +DECLARE_OP_USE_OUTPUT(CdistGrad) } // namespace mindspore::transform #endif // MINDSPORE_CCSRC_TRANSFORM_GRAPH_IR_OP_DECLARE_MATH_OPS_DECLARE_H_ diff --git a/mindspore/ccsrc/transform/graph_ir/op_declare/matrix_calculation_ops_declare.cc b/mindspore/ccsrc/transform/graph_ir/op_declare/matrix_calculation_ops_declare.cc index df3ae80e4b6..6f22f44ec37 100644 --- a/mindspore/ccsrc/transform/graph_ir/op_declare/matrix_calculation_ops_declare.cc +++ b/mindspore/ccsrc/transform/graph_ir/op_declare/matrix_calculation_ops_declare.cc @@ -15,6 +15,7 @@ */ #include "transform/graph_ir/op_declare/matrix_calculation_ops_declare.h" +#include namespace mindspore::transform { // TensorScatterUpdate @@ -116,6 +117,25 @@ ATTR_MAP(MatrixSetDiagD) = EMPTY_ATTR_MAP; OUTPUT_MAP(MatrixSetDiagD) = {{0, OUTPUT_DESC(y)}}; REG_ADPT_DESC(MatrixSetDiagD, kNameMatrixSetDiagD, ADPT_DESC(MatrixSetDiagD)) +// MatrixDiagPart +INPUT_MAP(MatrixDiagPart) = {{1, INPUT_DESC(x)}}; +ATTR_MAP(MatrixDiagPart) = EMPTY_ATTR_MAP; +OUTPUT_MAP(MatrixDiagPart) = {{0, OUTPUT_DESC(y)}}; +REG_ADPT_DESC(MatrixDiagPart, kMatrixDiagPartDOpName, ADPT_DESC(MatrixDiagPart)) + +// MatrixSetDiag +INPUT_MAP(MatrixSetDiag) = {{1, INPUT_DESC(x)}}; +ATTR_MAP(MatrixSetDiag) = EMPTY_ATTR_MAP; +OUTPUT_MAP(MatrixSetDiag) = {{0, OUTPUT_DESC(y)}}; +REG_ADPT_DESC(MatrixSetDiag, kMatrixSetDiagDOpName, ADPT_DESC(MatrixSetDiag)) + +// ConfusionMatrix +INPUT_MAP(ConfusionMatrix) = {{1, INPUT_DESC(labels)}, {2, INPUT_DESC(predictions)}, {3, INPUT_DESC(weights)}}; +ATTR_MAP(ConfusionMatrix) = {{"num_classes", ATTR_DESC(num_classes, AnyTraits())}, + {"dtype", ATTR_DESC(dtype, AnyTraits())}}; +OUTPUT_MAP(ConfusionMatrix) = {{0, OUTPUT_DESC(y)}}; +REG_ADPT_DESC(ConfusionMatrix, kNameConfusionMatrix, ADPT_DESC(ConfusionMatrix)) + // DiagPart INPUT_MAP(DiagPart) = {{1, INPUT_DESC(x)}}; ATTR_MAP(DiagPart) = EMPTY_ATTR_MAP; diff --git a/mindspore/ccsrc/transform/graph_ir/op_declare/matrix_calculation_ops_declare.h b/mindspore/ccsrc/transform/graph_ir/op_declare/matrix_calculation_ops_declare.h index cb03e8cbaa0..74b5b058ac7 100644 --- a/mindspore/ccsrc/transform/graph_ir/op_declare/matrix_calculation_ops_declare.h +++ b/mindspore/ccsrc/transform/graph_ir/op_declare/matrix_calculation_ops_declare.h @@ -19,6 +19,7 @@ #include "utils/hash_map.h" #include "transform/graph_ir/op_declare/op_declare_macro.h" +#include "mindspore/ccsrc/include/common/utils/utils.h" #include "ops/matrix_calculation_ops.h" namespace mindspore::transform { @@ -90,5 +91,14 @@ DECLARE_OP_USE_OUTPUT(FullyConnection) DECLARE_OP_ADAPTER(IndexAdd) DECLARE_OP_USE_OUTPUT(IndexAdd) + +DECLARE_OP_ADAPTER(ConfusionMatrix) +DECLARE_OP_USE_OUTPUT(ConfusionMatrix) + +DECLARE_OP_ADAPTER(MatrixDiagPart) +DECLARE_OP_USE_OUTPUT(MatrixDiagPart) + +DECLARE_OP_ADAPTER(MatrixSetDiag) +DECLARE_OP_USE_OUTPUT(MatrixSetDiag) } // namespace mindspore::transform #endif // MINDSPORE_CCSRC_TRANSFORM_GRAPH_IR_OP_DECLARE_MATRIX_CALCULATION_OPS_DECLARE_H_ diff --git a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_calculation_ops_declare.cc b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_calculation_ops_declare.cc index 5910b3ff456..1467f283e7a 100644 --- a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_calculation_ops_declare.cc +++ b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_calculation_ops_declare.cc @@ -228,4 +228,17 @@ ATTR_MAP(DeformableOffsets) = { {"modulated", ATTR_DESC(modulated, AnyTraits())}}; OUTPUT_MAP(DeformableOffsets) = {{0, OUTPUT_DESC(y)}}; REG_ADPT_DESC(DeformableOffsets, kDeformableOffsetsOpName, ADPT_DESC(DeformableOffsets)) + +// DeformableOffsetsGrad +INPUT_MAP(DeformableOffsetsGrad) = {{1, INPUT_DESC(grad)}, {2, INPUT_DESC(x)}, {3, INPUT_DESC(offsets)}}; +ATTR_MAP(DeformableOffsetsGrad) = { + {"strides", ATTR_DESC(strides, AnyTraits>(), AnyTraits>())}, + {"pads", ATTR_DESC(pads, AnyTraits>(), AnyTraits>())}, + {"ksize", ATTR_DESC(ksize, AnyTraits>(), AnyTraits>())}, + {"data_format", ATTR_DESC(data_format, AnyTraits())}, + {"dilations", ATTR_DESC(dilations, AnyTraits>(), AnyTraits>())}, + {"deformable_groups", ATTR_DESC(deformable_groups, AnyTraits())}, + {"modulated", ATTR_DESC(modulated, AnyTraits())}}; +OUTPUT_MAP(DeformableOffsetsGrad) = {{0, OUTPUT_DESC(grad_x)}, {1, OUTPUT_DESC(grad_offsets)}}; +REG_ADPT_DESC(DeformableOffsetsGrad, prim::kPrimDeformableOffsetsGrad->name(), ADPT_DESC(DeformableOffsetsGrad)) } // namespace mindspore::transform diff --git a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_calculation_ops_declare.h b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_calculation_ops_declare.h index 3684a870fa1..d46e74a6971 100644 --- a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_calculation_ops_declare.h +++ b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_calculation_ops_declare.h @@ -75,5 +75,8 @@ DECLARE_OP_USE_OUTPUT(Conv2DTransposeD) DECLARE_OP_ADAPTER(DeformableOffsets) DECLARE_OP_USE_OUTPUT(DeformableOffsets) + +DECLARE_OP_ADAPTER(DeformableOffsetsGrad) +DECLARE_OP_USE_OUTPUT(DeformableOffsetsGrad) } // namespace mindspore::transform #endif // MINDSPORE_CCSRC_TRANSFORM_GRAPH_IR_OP_DECLARE_NN_CALCULATION_OPS_DECLARE_H_ diff --git a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_detect_ops_declare.cc b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_detect_ops_declare.cc index 8cdd4f22210..744e838f6d4 100644 --- a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_detect_ops_declare.cc +++ b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_detect_ops_declare.cc @@ -84,4 +84,12 @@ ATTR_MAP(ROIAlignGrad) = { {"spatial_scale", ATTR_DESC(spatial_scale, AnyTraits())}, {"sample_num", ATTR_DESC(sample_num, AnyTraits())}}; REG_ADPT_DESC(ROIAlignGrad, kNameROIAlignGrad, ADPT_DESC(ROIAlignGrad)) + +// PSROIPooling +INPUT_MAP(PSROIPooling) = {{1, INPUT_DESC(x)}, {2, INPUT_DESC(rois)}}; +ATTR_MAP(PSROIPooling) = {{"output_dim", ATTR_DESC(output_dim, AnyTraits())}, + {"group_size", ATTR_DESC(group_size, AnyTraits())}, + {"spatial_scale", ATTR_DESC(spatial_scale, AnyTraits())}}; +OUTPUT_MAP(PSROIPooling) = {{0, OUTPUT_DESC(y)}}; +REG_ADPT_DESC(PSROIPooling, prim::kPrimPSROIPooling->name(), ADPT_DESC(PSROIPooling)) } // namespace mindspore::transform diff --git a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_detect_ops_declare.h b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_detect_ops_declare.h index 5ca4671876b..d6be1d449db 100644 --- a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_detect_ops_declare.h +++ b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_detect_ops_declare.h @@ -42,5 +42,8 @@ DECLARE_OP_USE_OUTPUT(ROIAlign) DECLARE_OP_ADAPTER(ROIAlignGrad) DECLARE_OP_USE_OUTPUT(ROIAlignGrad) + +DECLARE_OP_ADAPTER(PSROIPooling) +DECLARE_OP_USE_OUTPUT(PSROIPooling) } // namespace mindspore::transform #endif // MINDSPORE_CCSRC_TRANSFORM_GRAPH_IR_OP_DECLARE_NN_DETECT_OPS_DECLARE_H_ diff --git a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_norm_ops_declare.cc b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_norm_ops_declare.cc index 6d973ecae7f..16bf7a634a0 100644 --- a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_norm_ops_declare.cc +++ b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_norm_ops_declare.cc @@ -182,4 +182,18 @@ INPUT_MAP(Roll) = {{1, INPUT_DESC(x)}}; ATTR_MAP(Roll) = {{"shift", ATTR_DESC(shifts, AnyTraits(), AnyTraits>())}}; OUTPUT_MAP(Roll) = {{0, OUTPUT_DESC(y)}}; REG_ADPT_DESC(Roll, prim::kRoll, ADPT_DESC(Roll)) + +// Renorm +INPUT_MAP(Renorm) = {{1, INPUT_DESC(x)}}; +ATTR_MAP(Renorm) = {{"p", ATTR_DESC(p, AnyTraits())}, + {"dim", ATTR_DESC(dim, AnyTraits())}, + {"maxnorm", ATTR_DESC(maxnorm, AnyTraits())}}; +OUTPUT_MAP(Renorm) = {{0, OUTPUT_DESC(y)}}; +REG_ADPT_DESC(Renorm, prim::kPrimRenorm->name(), ADPT_DESC(Renorm)) + +// SoftMarginLoss +INPUT_MAP(SoftMarginLoss) = {{1, INPUT_DESC(input_x)}, {2, INPUT_DESC(input_y)}}; +ATTR_MAP(SoftMarginLoss) = {{"reduction", ATTR_DESC(reduction, AnyTraits())}}; +OUTPUT_MAP(SoftMarginLoss) = {{0, OUTPUT_DESC(output_z)}}; +REG_ADPT_DESC(SoftMarginLoss, prim::kPrimSoftMarginLoss->name(), ADPT_DESC(SoftMarginLoss)) } // namespace mindspore::transform diff --git a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_norm_ops_declare.h b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_norm_ops_declare.h index c49cf6b5674..6099b66c29f 100644 --- a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_norm_ops_declare.h +++ b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_norm_ops_declare.h @@ -90,5 +90,11 @@ DECLARE_OP_USE_OUTPUT(MultilabelMarginLoss) DECLARE_OP_ADAPTER(Roll) DECLARE_OP_USE_OUTPUT(Roll) + +DECLARE_OP_ADAPTER(Renorm) +DECLARE_OP_USE_OUTPUT(Renorm) + +DECLARE_OP_ADAPTER(SoftMarginLoss) +DECLARE_OP_USE_OUTPUT(SoftMarginLoss) } // namespace mindspore::transform #endif // MINDSPORE_CCSRC_TRANSFORM_GRAPH_IR_OP_DECLARE_IMAGE_OPS_DECLARE_H_ diff --git a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_pooling_ops_declare.cc b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_pooling_ops_declare.cc index 22c365fe539..ecf59ce280b 100644 --- a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_pooling_ops_declare.cc +++ b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_pooling_ops_declare.cc @@ -191,4 +191,29 @@ INPUT_MAP(AdaptiveMaxPool2d) = {{1, INPUT_DESC(x)}}; ATTR_MAP(AdaptiveMaxPool2d) = {{"output_size", ATTR_DESC(output_size, AnyTraits>())}}; OUTPUT_MAP(AdaptiveMaxPool2d) = {{0, OUTPUT_DESC(y)}, {1, OUTPUT_DESC(argmax)}}; REG_ADPT_DESC(AdaptiveMaxPool2d, kNameAdaptiveMaxPool2d, ADPT_DESC(AdaptiveMaxPool2d)) + +// AvgPool3DGrad +INPUT_MAP(AvgPool3DGrad) = {{1, INPUT_DESC(orig_input_shape)}, {2, INPUT_DESC(grads)}}; +ATTR_MAP(AvgPool3DGrad) = {{"kernel_size", ATTR_DESC(ksize, AnyTraits(), AnyTraits>())}, + {"strides", ATTR_DESC(strides, AnyTraits(), AnyTraits>())}, + {"pad_list", ATTR_DESC(pads, AnyTraits(), AnyTraits>())}, + {"ceil_mode", ATTR_DESC(ceil_mode, AnyTraits())}, + {"count_include_pad", ATTR_DESC(count_include_pad, AnyTraits())}, + {"divisor_override", ATTR_DESC(divisor_override, AnyTraits())}, + {"format", ATTR_DESC(data_format, AnyTraits())}}; +ATTR_INPUT_MAP(AvgPool3DGrad) = {{"origin_input_shape", 1}}; +OUTPUT_MAP(AvgPool3DGrad) = {{0, OUTPUT_DESC(output)}}; +REG_ADPT_DESC(AvgPool3DGrad, kAvgPool3DGradDOpName, ADPT_DESC(AvgPool3DGrad)) + +// Dilation2DBackpropFilter +INPUT_MAP(Dilation2DBackpropFilter) = {{1, INPUT_DESC(x)}, {2, INPUT_DESC(filter)}, {3, INPUT_DESC(out_backprop)}}; +ATTR_MAP(Dilation2DBackpropFilter) = {{"strides", ATTR_DESC(strides, AnyTraits>())}, + {"rates", ATTR_DESC(rates, AnyTraits>())}, + {"padding_mode", ATTR_DESC(padding_mode, AnyTraits())}, + {"pads", ATTR_DESC(pads, AnyTraits>())}, + {"ceil_mode", ATTR_DESC(ceil_mode, AnyTraits())}, + {"data_format", ATTR_DESC(data_format, AnyTraits())}}; +OUTPUT_MAP(Dilation2DBackpropFilter) = {{0, OUTPUT_DESC(y)}}; +REG_ADPT_DESC(Dilation2DBackpropFilter, prim::kPrimDilation2DBackpropFilter->name(), + ADPT_DESC(Dilation2DBackpropFilter)) } // namespace mindspore::transform diff --git a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_pooling_ops_declare.h b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_pooling_ops_declare.h index 8b22b0b8b9b..8dec23bd0af 100644 --- a/mindspore/ccsrc/transform/graph_ir/op_declare/nn_pooling_ops_declare.h +++ b/mindspore/ccsrc/transform/graph_ir/op_declare/nn_pooling_ops_declare.h @@ -19,6 +19,7 @@ #include "utils/hash_map.h" #include "transform/graph_ir/op_declare/op_declare_macro.h" +#include "mindspore/ccsrc/include/common/utils/utils.h" #include "ops/nn_ops.h" #include "ops/nn_pooling_ops.h" @@ -76,5 +77,11 @@ DECLARE_OP_USE_OUTPUT(GlobalAveragePool) DECLARE_OP_ADAPTER(Upsample) DECLARE_OP_USE_OUTPUT(Upsample) + +DECLARE_OP_ADAPTER(AvgPool3DGrad) +DECLARE_OP_USE_OUTPUT(AvgPool3DGrad) + +DECLARE_OP_ADAPTER(Dilation2DBackpropFilter) +DECLARE_OP_USE_OUTPUT(Dilation2DBackpropFilter) } // namespace mindspore::transform #endif // MINDSPORE_CCSRC_TRANSFORM_GRAPH_IR_OP_DECLARE_NN_POOLING_OPS_DECLARE_H_