acl op support

This commit is contained in:
zengzitao 2022-11-26 16:01:28 +08:00
parent 0863ef09bf
commit 34de144782
12 changed files with 166 additions and 0 deletions

View File

@ -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<int32_t>())},
};
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<float>())},
};
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<std::string>())},
};
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<float>())},
};
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<float>())},
};
OUTPUT_MAP(CdistGrad) = {{0, OUTPUT_DESC(y)}};
REG_ADPT_DESC(CdistGrad, prim::kPrimCdistGrad->name(), ADPT_DESC(CdistGrad))
} // namespace mindspore::transform

View File

@ -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_

View File

@ -15,6 +15,7 @@
*/
#include "transform/graph_ir/op_declare/matrix_calculation_ops_declare.h"
#include <string>
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<int64_t>())},
{"dtype", ATTR_DESC(dtype, AnyTraits<std::string>())}};
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;

View File

@ -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_

View File

@ -228,4 +228,17 @@ ATTR_MAP(DeformableOffsets) = {
{"modulated", ATTR_DESC(modulated, AnyTraits<bool>())}};
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<std::vector<int64_t>>(), AnyTraits<std::vector<int64_t>>())},
{"pads", ATTR_DESC(pads, AnyTraits<std::vector<int64_t>>(), AnyTraits<std::vector<int64_t>>())},
{"ksize", ATTR_DESC(ksize, AnyTraits<std::vector<int64_t>>(), AnyTraits<std::vector<int64_t>>())},
{"data_format", ATTR_DESC(data_format, AnyTraits<std::string>())},
{"dilations", ATTR_DESC(dilations, AnyTraits<std::vector<int64_t>>(), AnyTraits<std::vector<int64_t>>())},
{"deformable_groups", ATTR_DESC(deformable_groups, AnyTraits<int64_t>())},
{"modulated", ATTR_DESC(modulated, AnyTraits<bool>())}};
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

View File

@ -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_

View File

@ -84,4 +84,12 @@ ATTR_MAP(ROIAlignGrad) = {
{"spatial_scale", ATTR_DESC(spatial_scale, AnyTraits<float>())},
{"sample_num", ATTR_DESC(sample_num, AnyTraits<int64_t>())}};
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<int32_t>())},
{"group_size", ATTR_DESC(group_size, AnyTraits<int32_t>())},
{"spatial_scale", ATTR_DESC(spatial_scale, AnyTraits<float>())}};
OUTPUT_MAP(PSROIPooling) = {{0, OUTPUT_DESC(y)}};
REG_ADPT_DESC(PSROIPooling, prim::kPrimPSROIPooling->name(), ADPT_DESC(PSROIPooling))
} // namespace mindspore::transform

View File

@ -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_

View File

@ -182,4 +182,18 @@ INPUT_MAP(Roll) = {{1, INPUT_DESC(x)}};
ATTR_MAP(Roll) = {{"shift", ATTR_DESC(shifts, AnyTraits<int64_t>(), AnyTraits<std::vector<int64_t>>())}};
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<float>())},
{"dim", ATTR_DESC(dim, AnyTraits<int64_t>())},
{"maxnorm", ATTR_DESC(maxnorm, AnyTraits<float>())}};
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<std::string>())}};
OUTPUT_MAP(SoftMarginLoss) = {{0, OUTPUT_DESC(output_z)}};
REG_ADPT_DESC(SoftMarginLoss, prim::kPrimSoftMarginLoss->name(), ADPT_DESC(SoftMarginLoss))
} // namespace mindspore::transform

View File

@ -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_

View File

@ -191,4 +191,29 @@ INPUT_MAP(AdaptiveMaxPool2d) = {{1, INPUT_DESC(x)}};
ATTR_MAP(AdaptiveMaxPool2d) = {{"output_size", ATTR_DESC(output_size, AnyTraits<std::vector<int64_t>>())}};
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<int64_t>(), AnyTraits<std::vector<int64_t>>())},
{"strides", ATTR_DESC(strides, AnyTraits<int64_t>(), AnyTraits<std::vector<int64_t>>())},
{"pad_list", ATTR_DESC(pads, AnyTraits<int64_t>(), AnyTraits<std::vector<int64_t>>())},
{"ceil_mode", ATTR_DESC(ceil_mode, AnyTraits<bool>())},
{"count_include_pad", ATTR_DESC(count_include_pad, AnyTraits<bool>())},
{"divisor_override", ATTR_DESC(divisor_override, AnyTraits<int64_t>())},
{"format", ATTR_DESC(data_format, AnyTraits<std::string>())}};
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<std::vector<int64_t>>())},
{"rates", ATTR_DESC(rates, AnyTraits<std::vector<int64_t>>())},
{"padding_mode", ATTR_DESC(padding_mode, AnyTraits<std::string>())},
{"pads", ATTR_DESC(pads, AnyTraits<std::vector<int64_t>>())},
{"ceil_mode", ATTR_DESC(ceil_mode, AnyTraits<bool>())},
{"data_format", ATTR_DESC(data_format, AnyTraits<std::string>())}};
OUTPUT_MAP(Dilation2DBackpropFilter) = {{0, OUTPUT_DESC(y)}};
REG_ADPT_DESC(Dilation2DBackpropFilter, prim::kPrimDilation2DBackpropFilter->name(),
ADPT_DESC(Dilation2DBackpropFilter))
} // namespace mindspore::transform

View File

@ -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_