/**
 * Copyright (c) 2026 Huawei Technologies Co., Ltd.
 * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
 * CANN Open Software License Agreement Version 2.0 (the "License").
 * Please refer to the License for details. You may not use this file except in compliance with the License.
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
 * See LICENSE in the root of the software repository for the full text of the License.
 */

/* Generated By CANNBot */

/*!
 * \file bounding_box_encode_proto.h
 * \brief Encode the offset between anchor boxes and ground truth boxes.
 */
#ifndef OPS_OP_PROTO_INC_BOUNDING_BOX_ENCODE_H_
#define OPS_OP_PROTO_INC_BOUNDING_BOX_ENCODE_H_

#include "graph/operator_reg.h"
#include "graph/types.h"

namespace ge {
/**
* @brief Encodes the offset between anchor boxes and ground truth boxes to
* generate regression targets for object detection . \n

* @par Inputs:
* Two inputs, including:
* @li anchor_box: Anchor boxes, a 2D Tensor of type float16 or float32
* with shape (N, 4). "N" indicates the number of anchor boxes,
* and the value "4" refers to "x1", "y1", "x2", and "y2".
* @li ground_truth_box: Ground-truth boxes, a 2D Tensor of type float16
* or float32 with shape (N, 4). It's dtype and shape should be
* same as anchor_box. The value "4" refers to "x1", "y1", "x2", and "y2" . \n

* @par Attributes:
* @li means: A list of 4 floats, the mean values for encoding offset
* normalization, default value is [0.0, 0.0, 0.0, 0.0].
* @li stds: A list of 4 floats, the standard deviation values for encoding
* offset normalization, default value is [1.0, 1.0, 1.0, 1.0]. Each element
* must not be 0 . \n

* @par Outputs:
* delats: Encoded offsets, a 2D Tensor of type float16 or float32
* with shape (N, 4), specifying the regression targets. It's dtype
* should be same as anchor_box . \n

* @attention Constraints:
* The dtypes of "anchor_box" and "ground_truth_box" must be the same.
* The shapes of "anchor_box" and "ground_truth_box" must be exactly the same,
* both (N, 4). The length of "means" and "stds" must be 4, and each element of
* "stds" must not be 0. The coordinate format is standard (x1, y1, x2, y2).
* The width and height are calculated with a +1 offset (w = x2 - x1 + 1,
* h = y2 - y1 + 1) to ensure they are at least 1.
*/
REG_OP(BoundingBoxEncode)
    .INPUT(anchor_box, TensorType({DT_FLOAT16, DT_FLOAT}))
    .INPUT(ground_truth_box, TensorType({DT_FLOAT16, DT_FLOAT}))
    .OUTPUT(delats, TensorType({DT_FLOAT16, DT_FLOAT}))
    .ATTR(means, ListFloat, {0.0, 0.0, 0.0, 0.0})
    .ATTR(stds, ListFloat, {1.0, 1.0, 1.0, 1.0})
    .OP_END_FACTORY_REG(BoundingBoxEncode)

} // namespace ge

#endif