HDK
|
#include <graph.h>
Classes | |
class | Definitions |
class | EdgeEnd |
struct | EdgeEndCompare |
class | NodeConstIterator |
class | Relationships |
Public Types | |
enum | Type { Type::Primitive = 0, Type::Fused = 1 } |
using | EdgeSet = std::set< EdgeEnd, EdgeEndCompare > |
using | EdgeConstIterator = EdgeSet::const_iterator |
Public Member Functions | |
Node ()=default | |
Node (std::string_view name, std::string_view op_type, std::string_view description, gsl::span< NodeArg *const > input_args, gsl::span< NodeArg *const > output_args, const NodeAttributes *attributes, std::string_view domain) | |
~Node ()=default | |
NodeIndex | Index () const noexcept |
const std::string & | Name () const noexcept |
const std::string & | OpType () const noexcept |
const std::string & | Domain () const noexcept |
const Path & | ModelPath () const noexcept |
int | Priority () const noexcept |
void | SetPriority (int priority) noexcept |
const std::string & | Description () const noexcept |
Node::Type | NodeType () const noexcept |
int | SinceVersion () const noexcept |
void | SetSinceVersion (int since_version) noexcept |
const ONNX_NAMESPACE::OpSchema * | Op () const noexcept |
bool | TryGetFunctionProto (ONNX_NAMESPACE::FunctionProto &func_proto) const |
bool | CanBeInlined () const |
const Function * | GetFunctionBody () const noexcept |
const std::vector< int > & | InputArgCount () const noexcept |
ConstPointerContainer < std::vector< NodeArg * > > | InputDefs () const noexcept |
ConstPointerContainer < std::vector< NodeArg * > > | ImplicitInputDefs () const noexcept |
ConstPointerContainer < std::vector< NodeArg * > > | OutputDefs () const noexcept |
std::vector< NodeArg * > & | MutableImplicitInputDefs () noexcept |
std::vector< int > & | MutableInputArgsCount () |
std::vector< NodeArg * > & | MutableInputDefs () noexcept |
std::vector< NodeArg * > & | MutableOutputDefs () noexcept |
NodeConstIterator | InputNodesBegin () const noexcept |
NodeConstIterator | InputNodesEnd () const noexcept |
NodeConstIterator | OutputNodesBegin () const noexcept |
NodeConstIterator | OutputNodesEnd () const noexcept |
EdgeConstIterator | InputEdgesBegin () const noexcept |
EdgeConstIterator | InputEdgesEnd () const noexcept |
EdgeConstIterator | OutputEdgesBegin () const noexcept |
EdgeConstIterator | OutputEdgesEnd () const noexcept |
const std::set< std::string > & | ControlInputs () const noexcept |
size_t | GetInputEdgesCount () const noexcept |
size_t | GetOutputEdgesCount () const noexcept |
void | AddAttributeProto (ONNX_NAMESPACE::AttributeProto value) |
void | AddAttribute (std::string attr_name, int64_t value) |
void | AddAttribute (std::string attr_name, gsl::span< const int64_t > values) |
ADD_ATTR_INTERFACES (float) | |
ADD_ATTR_INTERFACES (std::string) | |
ADD_ATTR_INTERFACES (ONNX_NAMESPACE::TensorProto) | |
ADD_ATTR_INTERFACES (ONNX_NAMESPACE::SparseTensorProto) | |
ADD_ATTR_INTERFACES (ONNX_NAMESPACE::TypeProto) | |
ADD_ATTR_SINGLE_INTERFACE (ONNX_NAMESPACE::GraphProto) | |
template<size_t N> | |
void | AddAttribute (std::string attr_name, const char(&value)[N]) |
const NodeAttributes & | GetAttributes () const noexcept |
bool | ClearAttribute (const std::string &attr_name) |
NodeAttributes & | GetMutableAttributes () noexcept |
int | PruneRemovableAttributes (gsl::span< const std::string > removable_attributes) |
const Graph * | GetGraphAttribute (const std::string &attr_name) const |
Graph * | GetMutableGraphAttribute (const std::string &attr_name) |
bool | ContainsSubgraph () const |
std::vector< gsl::not_null < const Graph * > > | GetSubgraphs () const |
const std::unordered_map < std::string, gsl::not_null < Graph * > > & | GetAttributeNameToMutableSubgraphMap () |
std::unordered_map < std::string, gsl::not_null < Graph * > > & | GetMutableMapOfAttributeNameToSubgraph () |
std::unordered_map < std::string, gsl::not_null < const Graph * > > | GetAttributeNameToSubgraphMap () const |
ProviderType | GetExecutionProviderType () const noexcept |
void | SetExecutionProviderType (ProviderType execution_provider_type) |
void | ForEachDef (std::function< void(const onnxruntime::NodeArg &, bool is_input)> func, bool include_missing_optional_defs=false) const |
void | ReplaceDefs (const std::map< const onnxruntime::NodeArg *, onnxruntime::NodeArg * > &replacements) |
void | ToProto (ONNX_NAMESPACE::NodeProto &proto, bool update_subgraphs=false) const |
Status | SaveToOrtFormat (flatbuffers::FlatBufferBuilder &builder, flatbuffers::Offset< onnxruntime::fbs::Node > &fbs_node) const |
flatbuffers::Offset < onnxruntime::fbs::NodeEdge > | SaveEdgesToOrtFormat (flatbuffers::FlatBufferBuilder &builder) const |
void | SetFunctionTemplate (const FunctionTemplate &func_template) |
Status | LoadFromOrtFormat (const onnxruntime::fbs::Node &fbs_node, const OrtFormatLoadOptions &load_options, const logging::Logger &logger) |
Status | LoadEdgesFromOrtFormat (const onnxruntime::fbs::NodeEdge &fbs_node_edgs, const Graph &graph) |
Node (NodeIndex index, Graph &graph) | |
Static Public Member Functions | |
static common::Status | ForEachWithIndex (const ConstPointerContainer< std::vector< NodeArg * >> &node_args, std::function< common::Status(const NodeArg &arg, size_t index)> func) |
static common::Status | ForEachMutableWithIndex (std::vector< NodeArg * > &node_args, std::function< common::Status(NodeArg &arg, size_t index)> func) |
static Status | LoadFromOrtFormat (const onnxruntime::fbs::Node &fbs_node, Graph &graph, const OrtFormatLoadOptions &load_options, const logging::Logger &logger, std::unique_ptr< Node > &node) |
Friends | |
class | Graph |
using onnxruntime::Node::EdgeConstIterator = EdgeSet::const_iterator |
using onnxruntime::Node::EdgeSet = std::set<EdgeEnd, EdgeEndCompare> |
|
strong |
|
explicitdefault |
|
inline |
|
default |
onnxruntime::Node::ADD_ATTR_INTERFACES | ( | float | ) |
onnxruntime::Node::ADD_ATTR_INTERFACES | ( | std::string | ) |
onnxruntime::Node::ADD_ATTR_INTERFACES | ( | ONNX_NAMESPACE::TensorProto | ) |
onnxruntime::Node::ADD_ATTR_INTERFACES | ( | ONNX_NAMESPACE::SparseTensorProto | ) |
onnxruntime::Node::ADD_ATTR_INTERFACES | ( | ONNX_NAMESPACE::TypeProto | ) |
onnxruntime::Node::ADD_ATTR_SINGLE_INTERFACE | ( | ONNX_NAMESPACE::GraphProto | ) |
void onnxruntime::Node::AddAttribute | ( | std::string | attr_name, |
int64_t | value | ||
) |
Adds an attribute to this Node with the specified attribute name and value.
void onnxruntime::Node::AddAttribute | ( | std::string | attr_name, |
gsl::span< const int64_t > | values | ||
) |
Adds an attribute to this Node with the specified attribute name and values.
|
inline |
void onnxruntime::Node::AddAttributeProto | ( | ONNX_NAMESPACE::AttributeProto | value | ) |
Adds an AttributeProto to this Node.
bool onnxruntime::Node::CanBeInlined | ( | ) | const |
bool onnxruntime::Node::ClearAttribute | ( | const std::string & | attr_name | ) |
Remove the specified attribute from this Node
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
void onnxruntime::Node::ForEachDef | ( | std::function< void(const onnxruntime::NodeArg &, bool is_input)> | func, |
bool | include_missing_optional_defs = false |
||
) | const |
Call the provided function for all explicit inputs, implicit inputs, and outputs of this Node. If the NodeArg is an explicit or implicit input, is_input will be true when func is called.
include_missing_optional_defs | Include NodeArgs that are optional and were not provided i.e. NodeArg::Exists() == false. |
|
inlinestatic |
Helper to iterate through the container returned by MutableInputDefs() or MutableOutputDefs() and call the provided function.
node_args | Collection of NodeArgs returned by MutableInputDefs() or MutableOutputDefs() |
func | Function to call for each valid NodeArg in the node_args. The function is called with the NodeArg and the index number in the container. |
|
inlinestatic |
Helper to iterate through the container returned by InputDefs() or OutputDefs() and call the provided function.
node_args | Collection of NodeArgs returned by InputDefs() or OutputDefs() |
func | Function to call for each valid NodeArg in the node_args. The function is called with the NodeArg and the index number in the container. |
|
inline |
std::unordered_map<std::string, gsl::not_null<const Graph*> > onnxruntime::Node::GetAttributeNameToSubgraphMap | ( | ) | const |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
const Graph* onnxruntime::Node::GetGraphAttribute | ( | const std::string & | attr_name | ) | const |
Gets the Graph instance that is instantiated from a GraphProto attribute during Graph::Resolve.
attr_name | Attribute name for the GraphProto attribute. |
|
inlinenoexcept |
|
inlinenoexcept |
Graph* onnxruntime::Node::GetMutableGraphAttribute | ( | const std::string & | attr_name | ) |
Gets the mutable Graph instance that is instantiated from a GraphProto attribute during Graph::Resolve.
attr_name | Attribute name for the GraphProto attribute. |
|
inline |
|
inlinenoexcept |
std::vector<gsl::not_null<const Graph*> > onnxruntime::Node::GetSubgraphs | ( | ) | const |
Get the const subgraphs from a node.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Gets the Node's input definitions.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Status onnxruntime::Node::LoadEdgesFromOrtFormat | ( | const onnxruntime::fbs::NodeEdge & | fbs_node_edgs, |
const Graph & | graph | ||
) |
|
static |
Status onnxruntime::Node::LoadFromOrtFormat | ( | const onnxruntime::fbs::Node & | fbs_node, |
const OrtFormatLoadOptions & | load_options, | ||
const logging::Logger & | logger | ||
) |
|
noexcept |
Gets the path of the owning model if any.
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Gets the Node's Node::Type.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Gets the Node's output definitions.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
int onnxruntime::Node::PruneRemovableAttributes | ( | gsl::span< const std::string > | removable_attributes | ) |
Clears removable attributes. These are no longer needed after the initialization of the session. The function returns the number of removed attributes.
void onnxruntime::Node::ReplaceDefs | ( | const std::map< const onnxruntime::NodeArg *, onnxruntime::NodeArg * > & | replacements | ) |
flatbuffers::Offset<onnxruntime::fbs::NodeEdge> onnxruntime::Node::SaveEdgesToOrtFormat | ( | flatbuffers::FlatBufferBuilder & | builder | ) | const |
Status onnxruntime::Node::SaveToOrtFormat | ( | flatbuffers::FlatBufferBuilder & | builder, |
flatbuffers::Offset< onnxruntime::fbs::Node > & | fbs_node | ||
) | const |
|
inline |
void onnxruntime::Node::SetFunctionTemplate | ( | const FunctionTemplate & | func_template | ) |
Sets the execution priority of a node.
|
inlinenoexcept |
void onnxruntime::Node::ToProto | ( | ONNX_NAMESPACE::NodeProto & | proto, |
bool | update_subgraphs = false |
||
) | const |
bool onnxruntime::Node::TryGetFunctionProto | ( | ONNX_NAMESPACE::FunctionProto & | func_proto | ) | const |
Create a copy of the called op's FunctionProto if it has one. Returns true if successful.