/**
 * 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_infershape.cpp
 * \brief Cosh 算子形状/类型推导实现
 *
 * 逐元素一元算子:y.shape = x.shape,y.dtype = x.dtype(spec outputs[].shape_rule / dtype_rule)。
 */

#include "register/op_impl_registry.h"
#include "exe_graph/runtime/infer_shape_context.h"
#include "op_common/log/log.h"

using namespace ge;

namespace ops {

// 形状推导:输出形状 = 输入形状
static ge::graphStatus InferShape4Cosh(gert::InferShapeContext* context)
{
    const gert::Shape* input_shape = context->GetInputShape(0);
    OP_CHECK_NULL_WITH_CONTEXT(context, input_shape);

    gert::Shape* output_shape = context->GetOutputShape(0);
    OP_CHECK_NULL_WITH_CONTEXT(context, output_shape);

    *output_shape = *input_shape;

    return ge::GRAPH_SUCCESS;
}

// 类型推导:输出类型 = 输入类型
static ge::graphStatus InferDataType4Cosh(gert::InferDataTypeContext* context)
{
    const ge::DataType x_dtype = context->GetInputDataType(0);
    context->SetOutputDataType(0, x_dtype);
    return ge::GRAPH_SUCCESS;
}

IMPL_OP_INFERSHAPE(Cosh)
    .InferShape(InferShape4Cosh)
    .InferDataType(InferDataType4Cosh);

} // namespace ops