Merged
GLU InferDataType 推导注册 #13469
esok11Add on 19 days ago
GLU InferDataType 推导注册 #13469
Merged
Merged fromesok11/ops-nnf1103intocann/ops-nnmaster
Total: 1 files changed+38-0
| @@ -0,0 +1,38 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2025 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | + * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +/*! | ||
| 12 | + * \file glu_graph_infer.cpp | ||
| 13 | + * \brief GLU InferDataType implementation (graph mode) | ||
| 14 | + */ | ||
| 15 | + | ||
| 16 | +#include "log/log.h" | ||
| 17 | +#include "register/op_impl_registry.h" | ||
| 18 | + | ||
| 19 | +using namespace ge; | ||
| 20 | + | ||
| 21 | +namespace { | ||
| 22 | +constexpr size_t GLU_IN_X = 0; | ||
| 23 | +constexpr size_t GLU_OUT_Y = 0; | ||
| 24 | +} // namespace | ||
| 25 | + | ||
| 26 | +namespace ops { | ||
| 27 | +static ge::graphStatus InferDataTypeForGlu(gert::InferDataTypeContext* context) | ||
| 28 | +{ | ||
| 29 | + OP_CHECK_IF(context == nullptr, OP_LOGE("GLU", "InferDataType context is nullptr."), return ge::GRAPH_FAILED); | ||
| 30 | + OP_LOGD(context->GetNodeName(), "Begin to do InferDataTypeForGlu"); | ||
| 31 | + const ge::DataType dtype = context->GetInputDataType(GLU_IN_X); | ||
| 32 | + ge::graphStatus ret = context->SetOutputDataType(GLU_OUT_Y, dtype); | ||
| 33 | + OP_LOGD(context->GetNodeName(), "End to do InferDataTypeForGlu"); | ||
| 34 | + return ret; | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +IMPL_OP(GLU).InferDataType(InferDataTypeForGlu); | ||
| 38 | +} // namespace ops | ||