HDK
|
#include <graph_viewer.h>
Public Member Functions | |
GraphViewer (const Graph &graph) | |
GraphViewer (const Graph &graph, const IndexedSubGraph &filter_info) | |
const std::string & | Name () const noexcept |
const std::string & | Description () const noexcept |
const std::filesystem::path & | ModelPath () const noexcept |
bool | GetInitializedTensor (const std::string &tensor_name, const ONNX_NAMESPACE::TensorProto *&value) const |
bool | CanOverrideInitializer () const noexcept |
const std::vector< const NodeArg * > & | GetInputs () const noexcept |
const std::vector< const NodeArg * > & | GetInputsIncludingInitializers () const noexcept |
const std::vector< const NodeArg * > & | GetOutputs () const noexcept |
bool | NodeProducesGraphOutput (const Node &node) const |
const std::unordered_set < const NodeArg * > & | GetValueInfo () const noexcept |
const Node * | GetNode (NodeIndex node_index) const |
const ConstGraphNodes & | Nodes () const noexcept |
int | NumberOfNodes () const noexcept |
int | MaxNodeIndex () const noexcept |
const std::vector< NodeIndex > & | GetNodesInTopologicalOrder (ExecutionOrder order=ExecutionOrder::DEFAULT) const |
const std::vector< NodeIndex > & | GetRootNodes () const |
const InitializedTensorSet & | GetAllInitializedTensors () const noexcept |
const NodeArg * | GetNodeArg (const std::string &name) const |
const std::unordered_map < std::string, int > & | DomainToVersionMap () const noexcept |
bool | IsSubgraph () const |
const Graph & | GetGraph () const |
const std::unordered_set < std::string > & | GetOuterScopeNodeArgNames () const noexcept |
bool | IsConstantInitializer (const std::string &name, bool check_outer_scope) const |
bool | IsInitializedTensor (const std::string &name) const |
const ONNX_NAMESPACE::TensorProto * | GetConstantInitializer (const std::string &name, bool check_outer_scope=true) const |
const Node * | ParentNode () const noexcept |
std::vector< const Node * > | GetConsumerNodes (const std::string &node_arg_name) const |
const Node * | GetProducerNode (const std::string &node_arg_name) const |
const IndexedSubGraph * | GetFilterInfo () const |
IOnnxRuntimeOpSchemaCollectionPtr | GetSchemaRegistry () const |
Class that provides a read-only view of the Graph.
Definition at line 28 of file graph_viewer.h.
|
explicit |
Construct a GraphViewer from the provided Graph instance.
|
explicit |
Construct a GraphViewer from the provided Graph instance, filtering to the nodes specified in the IndexedSubGraph
|
noexcept |
Returns true if an initializer value can be overridden by a graph input with the same name.
|
noexcept |
Gets the Graph description.
|
inlinenoexcept |
Gets the map of operator domains to their opset versions.
Definition at line 137 of file graph_viewer.h.
|
noexcept |
Gets all tensors created from initializers.
const ONNX_NAMESPACE::TensorProto* onnxruntime::GraphViewer::GetConstantInitializer | ( | const std::string & | name, |
bool | check_outer_scope = true |
||
) | 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 |
Get the consumer nodes of a node arg
Definition at line 177 of file graph_viewer.h.
|
inline |
Get the filter info that restricts the graph viewer to a subset of nodes if set.
Definition at line 190 of file graph_viewer.h.
|
inline |
Get the internal graph
Definition at line 145 of file graph_viewer.h.
bool onnxruntime::GraphViewer::GetInitializedTensor | ( | const std::string & | tensor_name, |
const ONNX_NAMESPACE::TensorProto *& | value | ||
) | const |
Gets a tensor created from an initializer.
tensor_name | The tensor name | |
[out] | value | Sets the pointer to the TensorProto if found, or nullptr if not. |
|
noexcept |
Gets the Graph inputs, excluding initializers.
|
noexcept |
Gets the Graph inputs, including any initializers.
const NodeArg* onnxruntime::GraphViewer::GetNodeArg | ( | const std::string & | name | ) | const |
const std::vector<NodeIndex>& onnxruntime::GraphViewer::GetNodesInTopologicalOrder | ( | ExecutionOrder | order = ExecutionOrder::DEFAULT | ) | const |
Gets the NodeIndex values for the Graph nodes, sorted into topological order.
|
noexcept |
|
noexcept |
Gets the Graph outputs.
|
inline |
Get the producer node of a node arg
Definition at line 182 of file graph_viewer.h.
const std::vector<NodeIndex>& onnxruntime::GraphViewer::GetRootNodes | ( | ) | const |
|
inline |
Definition at line 193 of file graph_viewer.h.
|
noexcept |
bool onnxruntime::GraphViewer::IsConstantInitializer | ( | const std::string & | name, |
bool | check_outer_scope | ||
) | const |
returns true if 'name' is an initializer, and is constant and cannot be overridden at runtime.
check_outer_scope | If true and the 'graph_' is a subgraph, check parent graph/s for 'name' if the name is not found in 'graph_'. |
bool onnxruntime::GraphViewer::IsInitializedTensor | ( | const std::string & | name | ) | const |
Check if a given name is an initializer tensor's name in this graph.
bool onnxruntime::GraphViewer::IsSubgraph | ( | ) | const |
Checks if this is a Subgraph
|
noexcept |
Gets the maximum NodeIndex value used by Nodes in the Graph.
|
inlinenoexcept |
Gets the path of the owning model if any
Definition at line 47 of file graph_viewer.h.
|
noexcept |
Gets the Graph name.
bool onnxruntime::GraphViewer::NodeProducesGraphOutput | ( | const Node & | node | ) | const |
|
noexcept |
Gets an iterator over all the valid Nodes in the Graph.
|
noexcept |
Gets the number of valid nodes in the Graph.
|
inlinenoexcept |
Get the Node containing this Graph if IsSubgraph is true. Returns nullptr otherwise.
Definition at line 173 of file graph_viewer.h.