HDK
|
#include <graph.h>
Classes | |
struct | ResolveOptions |
Public Member Functions | |
const std::string & | Name () const noexcept |
const std::string & | Description () const noexcept |
const Path & | ModelPath () const |
bool | IsSubgraph () const |
const Graph * | ParentGraph () const |
Graph * | MutableParentGraph () |
bool | StrictShapeTypeInference () const |
void | SetName (const std::string &name) |
void | SetDescription (const std::string &description) |
common::Status | ReplaceInitializedTensor (ONNX_NAMESPACE::TensorProto new_initializer) |
common::Status | InjectExternalInitializedTensors (const InlinedHashMap< std::string, OrtValue > &external_initializers) |
void | AddInitializedTensor (const ONNX_NAMESPACE::TensorProto &tensor_proto) |
void | RemoveInitializedTensor (const std::string &tensor_name) |
bool | IsInitializedTensor (const std::string &name) const |
bool | IsSparseInitializer (const std::string &name) const |
bool | GetInitializedTensor (const std::string &tensor_name, const ONNX_NAMESPACE::TensorProto *&value) const |
const InitializedTensorSet & | GetAllInitializedTensors () const noexcept |
void | CleanAllInitializedTensors () noexcept |
bool | CanOverrideInitializer () const noexcept |
const ONNX_NAMESPACE::TensorProto * | GetConstantInitializer (const std::string &name, bool check_outer_scope) const |
const ONNX_NAMESPACE::TensorProto * | GetInitializer (const std::string &name, bool check_outer_scope) const |
const std::vector< const NodeArg * > & | GetInputs () const noexcept |
const std::vector< const NodeArg * > & | GetInputsIncludingInitializers () const noexcept |
bool | IsInputsIncludingInitializers (const NodeArg *node_arg) const noexcept |
const std::vector< const NodeArg * > & | GetOverridableInitializers () const |
const std::vector< const NodeArg * > & | GetOutputs () const noexcept |
bool | IsOutput (const NodeArg *node_arg) const noexcept |
bool | NodeProducesGraphOutput (const Node &node) const |
std::vector< int > | GetNodeOutputsInGraphOutputs (const Node &node) const |
const std::unordered_set < const NodeArg * > & | GetValueInfo () const noexcept |
void | AddValueInfo (const NodeArg *new_value_info) |
const Node * | GetNode (NodeIndex node_index) const |
Node * | GetNode (NodeIndex node_index) |
GraphNodes & | Nodes () noexcept |
const GraphNodes & | Nodes () const noexcept |
ConstGraphNodes | FilteredNodes (GraphNodes::NodeFilterFunc &&filter_func) const noexcept |
int | MaxNodeIndex () const noexcept |
int | NumberOfNodes () const noexcept |
NodeArg * | GetNodeArg (const std::string &name) |
const NodeArg * | GetNodeArg (const std::string &name) const |
NodeArg * | GetNodeArgIncludingParentGraphs (const std::string &node_arg_name) |
NodeArg & | GetOrCreateNodeArg (const std::string &name, const ONNX_NAMESPACE::TypeProto *p_arg_type) |
std::string | GenerateNodeArgName (const std::string &base_name) |
std::string | GenerateNodeName (const std::string &base_name) |
Node & | AddNode (const Node &other) |
Node & | AddNode (const std::string &name, const std::string &op_type, const std::string &description, gsl::span< NodeArg *const > input_args, gsl::span< NodeArg *const > output_args, const NodeAttributes *attributes=nullptr, const std::string &domain=kOnnxDomain) |
Node & | AddNode (const std::string &name, const std::string &op_type, const std::string &description, std::initializer_list< NodeArg * > input_args, std::initializer_list< NodeArg * > output_args, const NodeAttributes *attributes=nullptr, const std::string &domain=kOnnxDomain) |
Node & | AddNode (const std::string &name, const std::string &op_type, const std::string &description, gsl::span< NodeArg *const > input_args, std::initializer_list< NodeArg * > output_args, const NodeAttributes *attributes=nullptr, const std::string &domain=kOnnxDomain) |
Node & | AddNode (const std::string &name, const std::string &op_type, const std::string &description, std::initializer_list< NodeArg * > input_args, gsl::span< NodeArg *const > output_args, const NodeAttributes *attributes=nullptr, const std::string &domain=kOnnxDomain) |
bool | RemoveNode (NodeIndex node_index) |
void | AddEdge (NodeIndex src_node_index, NodeIndex dst_node_index, int src_arg_index, int dst_arg_index) |
void | RemoveEdge (NodeIndex src_node_index, NodeIndex dst_node_index, int src_arg_index, int dst_arg_index) |
bool | AddControlEdge (NodeIndex src_node_index, NodeIndex dst_node_index) |
Graph & | SetGraphResolveNeeded () noexcept |
bool | GraphResolveNeeded () const noexcept |
Graph & | SetGraphProtoSyncNeeded () noexcept |
bool | GraphProtoSyncNeeded () const noexcept |
void | ReverseDFSFrom (gsl::span< NodeIndex const > from, const std::function< void(const Node *)> &enter, const std::function< void(const Node *)> &leave, const std::function< bool(const Node *, const Node *)> &comp={}) const |
void | ReverseDFSFrom (gsl::span< const Node *const > from, const std::function< void(const Node *)> &enter, const std::function< void(const Node *)> &leave, const std::function< bool(const Node *, const Node *)> &comp={}) const |
void | ReverseDFSFrom (gsl::span< const Node *const > from, const std::function< void(const Node *)> &enter, const std::function< void(const Node *)> &leave, const std::function< bool(const Node *, const Node *)> &comp, const std::function< bool(const Node *, const Node *)> &stop) const |
void | KahnsTopologicalSort (const std::function< void(const Node *)> &enter, const std::function< bool(const Node *, const Node *)> &comp) const |
const std::unordered_map < std::string, int > & | DomainToVersionMap () const noexcept |
Node & | BeginFuseSubGraph (const IndexedSubGraph &sub_graph, const std::string &fused_node_name) |
void | FinalizeFuseSubGraph (const IndexedSubGraph &sub_graph, Node &fused_node) |
const ONNX_NAMESPACE::GraphProto & | ToGraphProto () |
ONNX_NAMESPACE::GraphProto | ToGraphProto () const |
ONNX_NAMESPACE::GraphProto | ToGraphProtoWithExternalInitializers (const std::string &external_file_name, const PathString &file_path, size_t initializer_size_threshold) const |
IOnnxRuntimeOpSchemaCollectionPtr | GetSchemaRegistry () const |
bool | SetOpSchemaFromRegistryForNode (Node &node) |
Node & | FuseSubGraph (const IndexedSubGraph &sub_graph, const std::string &fused_node_name) |
Status | InlineIfSubgraph (bool condition_value, Node &if_node, const logging::Logger &logger) |
Status | InlineFunction (Node &node) |
Status | InlineFunctionProto (const ONNX_NAMESPACE::FunctionProto &func_to_inline) |
void | AddOuterScopeNodeArg (const std::string &name) |
void | SetInputs (gsl::span< const NodeArg *const > inputs) |
void | SetInputs (std::initializer_list< const NodeArg * > inputs) |
const Model & | GetModel () const |
const logging::Logger & | GetLogger () const |
void | SetOutputs (gsl::span< const NodeArg *const > outputs) |
void | SetOutputs (std::initializer_list< const NodeArg * > outputs) |
void | SetNodeArgType (NodeArg &arg, const ONNX_NAMESPACE::TypeProto &type_proto) |
const Node * | GetProducerNode (const std::string &node_arg_name) const |
Node * | GetMutableProducerNode (const std::string &node_arg_name) |
void | UpdateProducerNode (const std::string &node_arg_name, NodeIndex node_index) |
std::vector< const Node * > | GetConsumerNodes (const std::string &node_arg_name) const |
void | AddConsumerNode (const std::string &node_arg_name, Node *consumer) |
void | RemoveConsumerNode (const std::string &node_arg_name, Node *consumer) |
std::vector< Node * > | GetMutableConsumerNodes (const std::string &node_arg_name) |
void | UpdateConsumerNodes (const std::string &node_arg_name, gsl::span< Node *const > nodes) |
void | UpdateConsumerNodes (const std::string &node_arg_name, std::initializer_list< Node * > nodes) |
Status | UpdateShapeInference (Node &node) |
common::Status | Resolve (const ResolveOptions &options) |
common::Status | Resolve () |
const std::unordered_set < std::string > & | GetOuterScopeNodeArgNames () const noexcept |
common::Status | SaveToOrtFormat (flatbuffers::FlatBufferBuilder &builder, flatbuffers::Offset< onnxruntime::fbs::Graph > &fbs_graph) const |
const Node * | ParentNode () const |
bool | IsOuterScopeValue (const std::string &name) const |
Graph (Graph &parent_graph, const Node &parent_node, ONNX_NAMESPACE::GraphProto &subgraph_proto) | |
Graph (const Model &owning_model, IOnnxRuntimeOpSchemaCollectionPtr schema_registry, ONNX_NAMESPACE::GraphProto &subgraph_proto, const std::unordered_map< std::string, int > &domain_version_map, const logging::Logger &logger, bool strict_shape_type_inference) | |
virtual | ~Graph () |
const RuntimeOptimizationRecordContainer & | RuntimeOptimizations () const |
RuntimeOptimizationRecordContainer & | MutableRuntimeOptimizations () |
Graph ()=delete | |
Graph (const Model &owning_model, const std::unordered_map< std::string, int > &domain_to_version, IOnnxRuntimeOpSchemaCollectionPtr schema_registry, Graph *parent_graph, const Node *parent_node, const logging::Logger &logger, bool strict_shape_type_inference) | |
Status | LoadFromOrtFormat (const onnxruntime::fbs::Graph &fbs_graph, const OrtFormatLoadOptions &load_options) |
Graph (const Model &owning_model, ONNX_NAMESPACE::GraphProto *graph_proto, const std::unordered_map< std::string, int > &domain_to_version, Version ir_version, IOnnxRuntimeOpSchemaCollectionPtr schema_registry, const logging::Logger &logger, bool strict_shape_type_inference) | |
Graph (const Model &owning_model, ONNX_NAMESPACE::GraphProto *graph_proto, const std::unordered_map< std::string, int > &domain_to_version, Version ir_version, IOnnxRuntimeOpSchemaCollectionPtr schema_registry, Graph *parent_graph, const Node *parent_node, const logging::Logger &logger, bool strict_shape_type_inference) | |
ORT_DISALLOW_COPY_ASSIGNMENT_AND_MOVE (Graph) | |
Static Public Member Functions | |
static Status | LoadFromOrtFormat (const onnxruntime::fbs::Graph &fbs_graph, const Model &owning_model, const std::unordered_map< std::string, int > &domain_to_version, IOnnxRuntimeOpSchemaCollectionPtr schema_registry, const OrtFormatLoadOptions &load_options, const logging::Logger &logger, std::unique_ptr< Graph > &graph) |
static Status | LoadFromOrtFormat (const onnxruntime::fbs::Graph &fbs_graph, Graph &parent_graph, const Node &parent_node, const OrtFormatLoadOptions &load_options, const logging::Logger &logger, std::unique_ptr< Graph > &graph) |
Friends | |
class | Model |
The Graph representation containing the graph inputs and outputs, the Node instances, and the edges connecting the nodes.
onnxruntime::Graph::Graph | ( | Graph & | parent_graph, |
const Node & | parent_node, | ||
ONNX_NAMESPACE::GraphProto & | subgraph_proto | ||
) |
onnxruntime::Graph::Graph | ( | const Model & | owning_model, |
IOnnxRuntimeOpSchemaCollectionPtr | schema_registry, | ||
ONNX_NAMESPACE::GraphProto & | subgraph_proto, | ||
const std::unordered_map< std::string, int > & | domain_version_map, | ||
const logging::Logger & | logger, | ||
bool | strict_shape_type_inference | ||
) |
|
virtual |
|
delete |
onnxruntime::Graph::Graph | ( | const Model & | owning_model, |
const std::unordered_map< std::string, int > & | domain_to_version, | ||
IOnnxRuntimeOpSchemaCollectionPtr | schema_registry, | ||
Graph * | parent_graph, | ||
const Node * | parent_node, | ||
const logging::Logger & | logger, | ||
bool | strict_shape_type_inference | ||
) |
onnxruntime::Graph::Graph | ( | const Model & | owning_model, |
ONNX_NAMESPACE::GraphProto * | graph_proto, | ||
const std::unordered_map< std::string, int > & | domain_to_version, | ||
Version | ir_version, | ||
IOnnxRuntimeOpSchemaCollectionPtr | schema_registry, | ||
const logging::Logger & | logger, | ||
bool | strict_shape_type_inference | ||
) |
onnxruntime::Graph::Graph | ( | const Model & | owning_model, |
ONNX_NAMESPACE::GraphProto * | graph_proto, | ||
const std::unordered_map< std::string, int > & | domain_to_version, | ||
Version | ir_version, | ||
IOnnxRuntimeOpSchemaCollectionPtr | schema_registry, | ||
Graph * | parent_graph, | ||
const Node * | parent_node, | ||
const logging::Logger & | logger, | ||
bool | strict_shape_type_inference | ||
) |
|
inline |
void onnxruntime::Graph::AddEdge | ( | NodeIndex | src_node_index, |
NodeIndex | dst_node_index, | ||
int | src_arg_index, | ||
int | dst_arg_index | ||
) |
Add an edge between two Nodes.
void onnxruntime::Graph::AddInitializedTensor | ( | const ONNX_NAMESPACE::TensorProto & | tensor_proto | ) |
Add an initializer tensor to the Graph.
Node& onnxruntime::Graph::AddNode | ( | const std::string & | name, |
const std::string & | op_type, | ||
const std::string & | description, | ||
gsl::span< NodeArg *const > | input_args, | ||
gsl::span< NodeArg *const > | output_args, | ||
const NodeAttributes * | attributes = nullptr , |
||
const std::string & | domain = kOnnxDomain |
||
) |
name | The Node name. Must be unique in this Graph. |
op_type | The operator type. e.g. ONNX operator name. |
description | Arbitrary description of the Node. |
input_args | The explicit inputs to this Node. |
output_args | The outputs from this Node. |
attributes | Optional NodeAttributes to add. |
domain | The domain for the op_type. |
|
inline |
|
inline |
|
inline |
|
inline |
Mark a NodeArg name as coming from the outer scope when programmatically constructing a Graph that will be used as a GraphProto attribute in another Node. e.g. when creating a Graph instance that will be used as a subgraph in a control flow operator, it is necessary to define placeholder NodeArgs for outer scope values. This prevents these values from becoming explicit graph inputs when the Graph is resolved.
Node& onnxruntime::Graph::BeginFuseSubGraph | ( | const IndexedSubGraph & | sub_graph, |
const std::string & | fused_node_name | ||
) |
Create a single Node that will be the result of the a fusion of multiple nodes in this Graph.
sub_graph | A IndexSubGraph instance with details of the nodes to fuse. |
fused_node_name | The name for the new Node. |
|
inlinenoexcept |
|
noexcept |
Removes all initializer tensors from this Graph and releases the memory they were using.
|
noexcept |
Gets the Graph description.
|
inlinenoexcept |
|
inlinenoexcept |
Get a ConstGraphNodes instance that provides access to a filtered set of valid Nodes in the Graph.
void onnxruntime::Graph::FinalizeFuseSubGraph | ( | const IndexedSubGraph & | sub_graph, |
Node & | fused_node | ||
) |
Node& onnxruntime::Graph::FuseSubGraph | ( | const IndexedSubGraph & | sub_graph, |
const std::string & | fused_node_name | ||
) |
Create a single Function based Node that is the result of the a fusion of multiple nodes in this Graph. A new Graph instance will be created for the fused nodes.
std::string onnxruntime::Graph::GenerateNodeArgName | ( | const std::string & | base_name | ) |
std::string onnxruntime::Graph::GenerateNodeName | ( | const std::string & | base_name | ) |
|
inlinenoexcept |
const ONNX_NAMESPACE::TensorProto* onnxruntime::Graph::GetConstantInitializer | ( | const std::string & | name, |
bool | check_outer_scope | ||
) | const |
returns the initializer's TensorProto if 'name' is an initializer, is constant and cannot be overridden at runtime. If the initializer is not found or is not constant, a nullptr is returned.
check_outer_scope | If true and the graph is a subgraph, check ancestor graph/s for 'name' if not found in 'graph'. |
|
inline |
bool onnxruntime::Graph::GetInitializedTensor | ( | const std::string & | tensor_name, |
const ONNX_NAMESPACE::TensorProto *& | value | ||
) | const |
Gets an initializer tensor with the provided name.
[out] | value | Set to the TensorProto* if the initializer is found, or nullptr if not. |
const ONNX_NAMESPACE::TensorProto* onnxruntime::Graph::GetInitializer | ( | const std::string & | name, |
bool | check_outer_scope | ||
) | const |
returns the initializer's TensorProto if 'name' is an initializer (both constant and overridable). If the initializer is not found, a nullptr is returned.
check_outer_scope | If true and the graph is a subgraph, check ancestor graph/s for 'name' if not found in 'graph'. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
NodeArg* onnxruntime::Graph::GetNodeArgIncludingParentGraphs | ( | const std::string & | node_arg_name | ) |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
IOnnxRuntimeOpSchemaCollectionPtr onnxruntime::Graph::GetSchemaRegistry | ( | ) | const |
Gets the ISchemaRegistry instances being used with this Graph.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Gets flag indicating whether Graph::Resolve needs to be called before using the Graph.
common::Status onnxruntime::Graph::InjectExternalInitializedTensors | ( | const InlinedHashMap< std::string, OrtValue > & | external_initializers | ) |
This function takes externally provided data for initializers with external data and replaces graph initializers with its content.
Status onnxruntime::Graph::InlineFunction | ( | Node & | node | ) |
Directly insert the nodes in the function Node provided into this Graph. The Graph needs to be Resolve()d after this call.
node | Node with Node::Type of Node::Type::Fused |
Status onnxruntime::Graph::InlineFunctionProto | ( | const ONNX_NAMESPACE::FunctionProto & | func_to_inline | ) |
Directly insert the nodes in the function proto provided into the graph. The function converts Constant nodes into the initializers in the graph. It then creates a node in the graph for each of the function nodes. All of the names are expected to be specialized, and, therefore unique. See function_utils::Specialize().
The Graph needs to be Resolve()d after this call.
func_to_inline |
Status onnxruntime::Graph::InlineIfSubgraph | ( | bool | condition_value, |
Node & | if_node, | ||
const logging::Logger & | logger | ||
) |
Directly insert one of the If node branches into this Graph. If
node condition must be a constant. The function would rename the nodes of the corresponding subgraph to make sure there is no conflict.
Explicit and implicit inputs references stay the same.
All of the outputs of the subgraph being inlined should be renamed to the outputs of the If node.
The function will process any subgraphs in each of the nodes being inlined, and will rename any references to the new names introduced.
condition_value | If condition value |
if_node | - the node that contains the graph_to_inline. This node is going to be deleted and replaced by the corresponding graph (either then or else) |
logger |
bool onnxruntime::Graph::IsInitializedTensor | ( | const std::string & | name | ) | const |
Check if a given name is an initializer tensor's name in this graph.
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
bool onnxruntime::Graph::IsSparseInitializer | ( | const std::string & | name | ) | const |
Check if a given name is a sparse initializer's name in the model we currently convert sparse_initializer field in the model into dense Tensor instances. However, we sometimes want to check if this initializer was stored as sparse in the model.
|
inline |
void onnxruntime::Graph::KahnsTopologicalSort | ( | const std::function< void(const Node *)> & | enter, |
const std::function< bool(const Node *, const Node *)> & | comp | ||
) | const |
Performs topological sort with Kahn's algorithm on the graph/s.
enter | Visit function that will be invoked on a node when it is visited. |
comp | Comparison function to stabilize the traversal order by making Node ordering deterministic. |
|
static |
|
static |
Status onnxruntime::Graph::LoadFromOrtFormat | ( | const onnxruntime::fbs::Graph & | fbs_graph, |
const OrtFormatLoadOptions & | load_options | ||
) |
|
inlinenoexcept |
const Path& onnxruntime::Graph::ModelPath | ( | ) | const |
Gets the path of the owning model, if any.
|
inline |
|
inline |
|
noexcept |
Gets the Graph name.
|
inline |
|
inlinenoexcept |
Get a GraphNodes instance that provides mutable access to all valid Nodes in the Graph.
|
inlinenoexcept |
Get a GraphNodes instance that provides const access to all valid Nodes in the Graph.
|
inlinenoexcept |
Gets the number of valid Nodes in the Graph.
onnxruntime::Graph::ORT_DISALLOW_COPY_ASSIGNMENT_AND_MOVE | ( | Graph | ) |
|
inline |
|
inline |
|
inline |
void onnxruntime::Graph::RemoveInitializedTensor | ( | const std::string & | tensor_name | ) |
Remove the initializer tensor with the provided name from the Graph.
bool onnxruntime::Graph::RemoveNode | ( | NodeIndex | node_index | ) |
Remove a Node from this Graph and free it. The output edges of this specified node MUST have been removed before removing the node. The input edges of this specified node is removed while removing the node. The process of removing a node from a graph should be,
common::Status onnxruntime::Graph::ReplaceInitializedTensor | ( | ONNX_NAMESPACE::TensorProto | new_initializer | ) |
Replaces the initializer tensor with the same name as the given initializer tensor. The replacement initializer tensor must have the same type and shape as the existing initializer tensor.
Note: This currently has linear time complexity. There is room for improvement but it would likely require changes to how initializer tensors are stored and tracked.
common::Status onnxruntime::Graph::Resolve | ( | const ResolveOptions & | options | ) |
Resolve this Graph to ensure it is completely valid, fully initialized, and able to be executed.
|
inline |
void onnxruntime::Graph::ReverseDFSFrom | ( | gsl::span< NodeIndex const > | from, |
const std::function< void(const Node *)> & | enter, | ||
const std::function< void(const Node *)> & | leave, | ||
const std::function< bool(const Node *, const Node *)> & | comp = {} |
||
) | const |
Performs a reverse depth-first search (DFS) traversal from a set of nodes, via their inputs, up to their source node/s.
from | NodeIndex values for a set of Nodes to traverse from. |
enter | Visit function that will be invoked on a node when it is visited but its parents haven't been. |
leave | Visit function invoked on the node after its parents have all been visited. |
comp | Comparison function to stabilize the traversal order by making Node ordering deterministic. |
void onnxruntime::Graph::ReverseDFSFrom | ( | gsl::span< const Node *const > | from, |
const std::function< void(const Node *)> & | enter, | ||
const std::function< void(const Node *)> & | leave, | ||
const std::function< bool(const Node *, const Node *)> & | comp = {} |
||
) | const |
Performs a reverse depth-first search (DFS) traversal from a set of nodes, via their inputs, up to their source node/s.
from | Set of Nodes to traverse from. |
enter | Visit function that will be invoked on a node when it is visited but its parents haven't been. |
leave | Visit function invoked on the node after its parents have all been visited. |
comp | Comparison function to stabilize the traversal order by making Node ordering deterministic. |
void onnxruntime::Graph::ReverseDFSFrom | ( | gsl::span< const Node *const > | from, |
const std::function< void(const Node *)> & | enter, | ||
const std::function< void(const Node *)> & | leave, | ||
const std::function< bool(const Node *, const Node *)> & | comp, | ||
const std::function< bool(const Node *, const Node *)> & | stop | ||
) | const |
Performs a reverse depth-first search (DFS) traversal from a set of nodes, via their inputs, up to their source node/s.
from | Set of Nodes to traverse from. |
enter | Visit function that will be invoked on a node when it is visited but its parents haven't been. |
leave | Visit function invoked on the node after its parents have all been visited. |
stop | Stop traversal from node n to input node p if stop(n, p) is true. |
comp | Comparison function to stabilize the traversal order by making Node ordering deterministic. |
|
inline |
common::Status onnxruntime::Graph::SaveToOrtFormat | ( | flatbuffers::FlatBufferBuilder & | builder, |
flatbuffers::Offset< onnxruntime::fbs::Graph > & | fbs_graph | ||
) | const |
void onnxruntime::Graph::SetDescription | ( | const std::string & | description | ) |
Gets the Graph description.
|
inlinenoexcept |
|
inlinenoexcept |
Explicitly set graph inputs.
inputs | NodeArgs that represent complete graph inputs which need to be explicitly ordered. |
void onnxruntime::Graph::SetName | ( | const std::string & | name | ) |
Sets the Graph name.
void onnxruntime::Graph::SetNodeArgType | ( | NodeArg & | arg, |
const ONNX_NAMESPACE::TypeProto & | type_proto | ||
) |
Sets the type of a NodeArg, replacing existing type/shape if any
bool onnxruntime::Graph::SetOpSchemaFromRegistryForNode | ( | Node & | node | ) |
Looks up the op schema in the schema registry and sets it for the given node.
node | The node to update. |
Explicitly set graph outputs.
outputs | NodeArgs that represent complete graph outputs which need to be explicitly ordered. |
|
inline |
const ONNX_NAMESPACE::GraphProto& onnxruntime::Graph::ToGraphProto | ( | ) |
Gets the GraphProto representation of this Graph.
ONNX_NAMESPACE::GraphProto onnxruntime::Graph::ToGraphProto | ( | ) | const |
ONNX_NAMESPACE::GraphProto onnxruntime::Graph::ToGraphProtoWithExternalInitializers | ( | const std::string & | external_file_name, |
const PathString & | file_path, | ||
size_t | initializer_size_threshold | ||
) | const |
Gets the GraphProto representation of this Graph external_file_name name of the binary file to use for initializers
initializer_size_threshold | initializers larger or equal to this threshold (in bytes) are saved in the external file. Initializer smaller than this threshold are included in the onnx file. |
|
inline |
|
inline |
|
inline |
Status onnxruntime::Graph::UpdateShapeInference | ( | Node & | node | ) |
During constant folding it may become possible to infer the shape for a node. To avoid running a full Resolve allow an individual node to have the shape inferencing re-run.