/**
 * 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 cosh_def.cpp
 * \brief Cosh 算子定义(单输入单输出逐元素算子)
 *
 * 输入 x / 输出 y 与 spec inputs/outputs 名称、数量一致。
 * 目标芯片 Ascend950PR(DAV_3510,spec platform_constraints.supported_chips)。
 *
 * 迭代二:整合全 3 dtype,按 spec dtype_policy.supported_combinations 注册
 *   float32(WithoutCast 直通)/ float16(WithCast 升精度)/ bfloat16(WithCast 升精度)。
 *   输出 dtype 恒等于输入 dtype(spec dtype_rule: y.dtype = x.dtype)。
 */
#include "register/op_def_registry.h"

namespace ops {
class Cosh : public OpDef {
public:
    explicit Cosh(const char* name) : OpDef(name)
    {
        this->Input("x")                                        // 输入 x(spec inputs[0])
            .ParamType(REQUIRED)                                // 必选输入
            .DataType({ge::DT_FLOAT, ge::DT_FLOAT16, ge::DT_BF16})  // 迭代二:全 3 dtype(spec dtype_policy)
            .Format({ge::FORMAT_ND, ge::FORMAT_ND, ge::FORMAT_ND})  // ND 格式
            .UnknownShapeFormat({ge::FORMAT_ND, ge::FORMAT_ND, ge::FORMAT_ND})  // 动态 shape 对应 format
            .AutoContiguous();                                  // 内存自动连续化
        this->Output("y")                                       // 输出 y(spec outputs[0],y.shape=x.shape,y.dtype=x.dtype)
            .ParamType(REQUIRED)
            .DataType({ge::DT_FLOAT, ge::DT_FLOAT16, ge::DT_BF16})  // 输出 dtype 恒等输入 dtype
            .Format({ge::FORMAT_ND, ge::FORMAT_ND, ge::FORMAT_ND})
            .UnknownShapeFormat({ge::FORMAT_ND, ge::FORMAT_ND, ge::FORMAT_ND})
            .AutoContiguous();

        // 标准 Ascend C kernel:目标芯片 ascend950(DAV_3510 / Ascend950PR)
        OpAICoreConfig aiCoreConfig;
        aiCoreConfig.DynamicCompileStaticFlag(true)
            .DynamicFormatFlag(false)
            .DynamicRankSupportFlag(true)
            .DynamicShapeSupportFlag(true)
            .NeedCheckSupportFlag(false)
            .PrecisionReduceFlag(true)
            .ExtendCfgInfo("opFile.value", "cosh_apt");
        this->AICore().AddConfig("ascend950", aiCoreConfig);
    }
};
OP_ADD(Cosh); // 添加算子信息库
} // namespace ops