HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
onnxruntime::NodeArg Class Reference

#include <node_arg.h>

Public Member Functions

 NodeArg (const std::string &name, const ONNX_NAMESPACE::TypeProto *p_arg_type)
 
 NodeArg (NodeArg &&)=default
 
NodeArgoperator= (NodeArg &&other)=default
 
const std::stringName () const noexcept
 
const std::stringType () const noexcept
 
const ONNX_NAMESPACE::TypeProto * TypeAsProto () const noexcept
 
const
ONNX_NAMESPACE::TensorShapeProto * 
Shape () const
 
bool HasTensorOrScalarShape () const
 
void SetShape (const ONNX_NAMESPACE::TensorShapeProto &shape)
 
void ClearShape ()
 
common::Status OverrideTypesHelper (const ONNX_NAMESPACE::TypeProto &input_type, int32_t input_tensor_elem_type, int32_t current_tensor_elem_type, bool override_types)
 
common::Status UpdateTypeAndShape (const ONNX_NAMESPACE::TypeProto &input_type, bool strict, bool override_types, const logging::Logger &logger)
 
common::Status UpdateTypeAndShape (const NodeArg &node_arg, bool strict, bool override_types, const logging::Logger &logger)
 
const NodeArgInfoToProto () const noexcept
 
bool Exists () const noexcept
 
 NodeArg (NodeArgInfo &&node_arg_info)
 

Friends

class Graph
 

Detailed Description

Class representing a data type that is input or output for a Node, including the shape if it is a Tensor.

Definition at line 35 of file node_arg.h.

Constructor & Destructor Documentation

onnxruntime::NodeArg::NodeArg ( const std::string name,
const ONNX_NAMESPACE::TypeProto *  p_arg_type 
)

Construct a new NodeArg.

Parameters
nameThe name to use.
p_arg_typeOptional TypeProto specifying type and shape information.
onnxruntime::NodeArg::NodeArg ( NodeArg &&  )
default
onnxruntime::NodeArg::NodeArg ( NodeArgInfo &&  node_arg_info)

Member Function Documentation

void onnxruntime::NodeArg::ClearShape ( )

Clears shape info.

Remarks
If there is a mismatch during shape inferencing that can't be resolved the shape info may be removed.
bool onnxruntime::NodeArg::Exists ( ) const
noexcept

Gets a flag indicating whether this NodeArg exists or not. Optional inputs are allowed in ONNX and an empty Name represents a non-existent input argument.

bool onnxruntime::NodeArg::HasTensorOrScalarShape ( ) const

Return an indicator.

Returns
true if NodeArg is a normal tensor with a non-empty shape or a scalar with an empty shape. Otherwise, returns false.
const std::string& onnxruntime::NodeArg::Name ( ) const
noexcept

Gets the name.

NodeArg& onnxruntime::NodeArg::operator= ( NodeArg &&  other)
default
common::Status onnxruntime::NodeArg::OverrideTypesHelper ( const ONNX_NAMESPACE::TypeProto &  input_type,
int32_t  input_tensor_elem_type,
int32_t  current_tensor_elem_type,
bool  override_types 
)

Override current type from input_type if override_types is set to true, return failure status otherwise.

Parameters
input_tensor_elem_typeTensor element type parsed input_type
current_tensor_elem_typeTensor element type parsed from existing type
override_typesIf true, resolve the two inputs or two outputs type when different
Returns
Success unless there is existing type or shape info that can't be successfully updated.
void onnxruntime::NodeArg::SetShape ( const ONNX_NAMESPACE::TensorShapeProto &  shape)

Sets the shape.

Remarks
Shape can only be set if the TypeProto was provided to the ctor, or #SetType has been called, as the shape information is stored as part of TypeProto.
const ONNX_NAMESPACE::TensorShapeProto* onnxruntime::NodeArg::Shape ( ) const

Gets the shape if NodeArg is for a Tensor.

Returns
TensorShapeProto if shape is set. nullptr if there's no shape specified.
const NodeArgInfo& onnxruntime::NodeArg::ToProto ( ) const
inlinenoexcept

Gets this NodeArg as a NodeArgInfo, AKA ValueInfoProto.

Definition at line 108 of file node_arg.h.

const std::string* onnxruntime::NodeArg::Type ( ) const
noexcept

Gets the data type.

const ONNX_NAMESPACE::TypeProto* onnxruntime::NodeArg::TypeAsProto ( ) const
noexcept

Gets the TypeProto

Returns
TypeProto if type is set. nullptr otherwise.
common::Status onnxruntime::NodeArg::UpdateTypeAndShape ( const ONNX_NAMESPACE::TypeProto &  input_type,
bool  strict,
bool  override_types,
const logging::Logger logger 
)

Validate and merge type [and shape] info from input_type.

Parameters
strictIf true, the shape update will fail if there are incompatible values. If false, will be lenient and merge only shape info that can be validly processed.
override_typesIf true, resolve the two inputs or two outputs type when different
Returns
Success unless there is existing type or shape info that can't be successfully updated.
common::Status onnxruntime::NodeArg::UpdateTypeAndShape ( const NodeArg node_arg,
bool  strict,
bool  override_types,
const logging::Logger logger 
)

Validate and merge type [and shape] info from node_arg.

Parameters
strictIf true, the shape update will fail if there are incompatible values. If false, will be lenient and merge only shape info that can be validly processed.
override_typesIf true, resolve the two inputs or two outputs type when different
Returns
Success unless there is existing type or shape info that can't be successfully updated.

Friends And Related Function Documentation

friend class Graph
friend

Definition at line 114 of file node_arg.h.


The documentation for this class was generated from the following file: