transform/rpn_ops_declare.cc

36 lines
1.8 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Copyright 2019 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.
*/
#include "transform/graph_ir/op_declare/rpn_ops_declare.h"
namespace mindspore::transform {
// NMSWithMask
INPUT_MAP(NMSWithMask) = {{1, INPUT_DESC(box_scores)}};
//输入映射输入的形参是box_scores
ATTR_MAP(NMSWithMask) = {{"iou_threshold", ATTR_DESC(iou_threshold, AnyTraits<float>())}};
//属性映射,其中包含一个属性 "iou_threshold"。该属性使用名为 "iou_threshold" 的属性描述(ATTR_DESC)
//并指定其值的类型为 float。"iou_threshold" 属性可能用于指定非极大值抑制 (NMS) 过程中的 IoU 阈值。
OUTPUT_MAP(NMSWithMask) = {
{0, OUTPUT_DESC(selected_boxes)}, {1, OUTPUT_DESC(selected_idx)}, {2, OUTPUT_DESC(selected_mask)}};
//定义 "NMSWithMask" 运算符的输出映射(OUTPUT_MAP)将输出索引0映射为名为 "selected_boxes" 的输出描述(OUTPUT_DESC)
//将输出索引1映射为名为 "selected_idx" 的输出描述将输出索引2映射为名为 "selected_mask" 的输出描述。
//这表示 "NMSWithMask" 运算符在计算过程中会产生三个输出结果。
REG_ADPT_DESC(NMSWithMask, kNameNMSWithMask, ADPT_DESC(NMSWithMask))
//注册 "NMSWithMask" 运算符的适配器描述(REG_ADPT_DESC)。
//适配器描述中包含运算符名称 "kNameNMSWithMask" 和适配器描述(ADPT_DESC)。
//这将把 "NMSWithMask" 运算符与其在框架中的实现关联起来。
} // namespace mindspore::transform