/** * Copyright 2019-2020 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. */ #ifndef INC_EXTERNAL_GRAPH_NODE_H_ #define INC_EXTERNAL_GRAPH_NODE_H_ #include #include #include "./ge_error_codes.h" #include "./types.h" #include "./tensor.h" #include "./ascend_string.h" namespace ge { class AttrValue; class GNode; class OpDesc; class Graph; class ComputeGraph; using GNodePtr = std::shared_ptr; using GraphPtr = std::shared_ptr; using OpBytes = std::vector; using OpDescPtr = std::shared_ptr; using ComputeGraphPtr = std::shared_ptr; class NodeImpl; class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GNode { public: GNode(); ~GNode() = default; graphStatus GetType(ge::AscendString &type) const; graphStatus GetName(ge::AscendString &name) const; std::pair GetInDataNodesAndPortIndexs(const int32_t index) const; std::vector GetInControlNodes() const; std::vector> GetOutDataNodesAndPortIndexs(const int32_t index) const; std::vector GetOutControlNodes() const; graphStatus GetInputConstData(const int32_t index, Tensor &data) const; graphStatus GetInputIndexByName(const ge::AscendString &name, int32_t &index); graphStatus GetOutputIndexByName(const ge::AscendString &name, int32_t &index); size_t GetInputsSize() const; size_t GetOutputsSize() const; graphStatus GetInputDesc(const int32_t index, TensorDesc &tensor_desc) const; graphStatus UpdateInputDesc(const int32_t index, const TensorDesc &tensor_desc); graphStatus GetOutputDesc(const int32_t index, TensorDesc &tensor_desc) const; graphStatus UpdateOutputDesc(const int32_t index, const TensorDesc &tensor_desc); graphStatus GetAttr(const ge::AscendString &name, int64_t &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, int32_t &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, uint32_t &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, float &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, ge::AscendString &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, bool &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, Tensor &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_values) const; graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, OpBytes &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, std::vector> &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, ge::DataType &attr_value) const; graphStatus GetAttr(const ge::AscendString &name, AttrValue &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, int64_t &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, int32_t &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, uint32_t &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, float &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, ge::AscendString &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, bool &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, Tensor &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_values) const; graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, OpBytes &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, std::vector> &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, ge::DataType &attr_value) const; graphStatus SetAttr(const ge::AscendString &name, AttrValue &attr_value) const; bool HasAttr(const ge::AscendString &name); graphStatus GetSubgraph(uint32_t index, GraphPtr graph) const; graphStatus GetALLSubgraphs(std::vector graph_list) const; private: std::shared_ptr impl_; friend class NodeAdapter; }; } // namespace ge #endif // INC_EXTERNAL_GRAPH_NODE_H_