ge_aipp_op.h 2.2 KB
Newer Older
L
lujiale 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
/**
 * Copyright 2019-2020 Huawei Technologies Co., Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef GE_GRAPH_PREPROCESS_INSERT_OP_GE_AIPP_OP_H_
#define GE_GRAPH_PREPROCESS_INSERT_OP_GE_AIPP_OP_H_

#include <utility>
#include <vector>

#include "common/op/attr_value_util.h"
#include "graph/preprocess/insert_op/base_insert_op.h"
#include "proto/insert_op.pb.h"

namespace ge {
class AippOp : public InsertOpBase {
 public:
  AippOp() {}
  Status Init(domi::AippOpParams *aipp_params);

  ~AippOp() override;

  ///
  /// @ingroup domi_omg
  /// @brief Set Default Params
  ///
  Status SetDefaultParams() override;

  ///
  /// @ingroup domi_omg
  /// @brief Validate Params
  ///
  Status ValidateParams() override;

 protected:
  ///
  /// @ingroup domi_omg
  /// @brief Generate Op Desc
  ///

  Status GenerateOpDesc(ge::OpDescPtr op_desc) override;

  ///
  /// @ingroup domi_omg
  /// @brief Get Target Position
  /// @param [in] graph graph
  /// @param [in|out] target_input target input
  /// @param [in|out] target_edges target edges
  ///
  Status GetTargetPosition(ge::ComputeGraphPtr graph, ge::NodePtr &target_input,
                           std::vector<std::pair<ge::OutDataAnchorPtr, ge::InDataAnchorPtr>> &target_edges) override;

  domi::AippOpParams::AippMode GetAippMode() override;

 private:
  AippOp& operator=(const AippOp& aipp_op);
  AippOp(const AippOp& aipp_op);

  ///
  /// @ingroup domi_omg
  /// @brief Convert Param To Attr
  ///
  void ConvertParamToAttr(ge::GeAttrValue::NamedAttrs &aipp_attrs);
  void SetCscDefaultValue();

  void SetDtcDefaultValue();

  domi::AippOpParams *aipp_params_;
  ge::NodePtr aipp_node_ = nullptr;
};
}  // namespace ge

#endif  // GE_GRAPH_PREPROCESS_INSERT_OP_GE_AIPP_OP_H_