NVIDIA NvNeural SDK  2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
nvneural::XmlParameterNode Class Reference

IParameterNode implementation wrapping a pugi::xml_node. More...

#include <XmlParameterNode.h>

Inheritance diagram for nvneural::XmlParameterNode:
nvneural::refobj::RefObjectBase< refobj::Implements< IParameterNode > >

Public Member Functions

NeuralResult getDimension (const char *pParameterName, TensorDimension *pDimOut) const noexcept
 Retrieves a tensor dimension. More...
 
NeuralResult getFloat (const char *pParameterName, float *pFloatOut) const noexcept
 Retrieves a floating-point value. More...
 
NeuralResult getInteger (const char *pParameterName, int32_t *pIntOut) const noexcept
 Retrieves a signed integer value. More...
 
NeuralResult getSize (const char *pParameterName, size_t *pSizeOut) const noexcept
 Retrieves an unsigned integer value that can represent the result of sizeof(). More...
 
NeuralResult getString (const char *pParameterName, const char **pStringOut) const noexcept
 Retrieves a UTF-8 string value. More...
 
NeuralResult setDimension (const char *pParameterName, TensorDimension value) noexcept
 Saves a tensor dimension. More...
 
NeuralResult setFloat (const char *pParameterName, float value) noexcept
 Saves a floating-point value. More...
 
NeuralResult setInteger (const char *pParameterName, int32_t value) noexcept
 Saves an integer. More...
 
NeuralResult setSize (const char *pParameterName, size_t value) noexcept
 Saves an unsigned integer that can represent the result of sizeof(). More...
 
NeuralResult setString (const char *pParameterName, const char *pString) noexcept
 Saves a UTF-8 string value. More...
 
 XmlParameterNode (pugi::xml_node node)
 Creates an XmlParameterNode. More...
 
- Public Member Functions inherited from nvneural::refobj::RefObjectBase< refobj::Implements< IParameterNode > >
IRefObject::RefCount addRef () const noexcept
 Increment the object's reference count. More...
 
const void * queryInterface (IRefObject::TypeId interfaceId) const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void * queryInterface (IRefObject::TypeId interfaceId) noexcept
 Retrieves a new object interface pointer. More...
 
 RefObjectBase ()
 Default constructor. Logs object creation.
 
IRefObject::RefCount release () const noexcept
 Decrements the object's reference count and destroys the object if the reference count reaches zero. More...
 

Detailed Description

IParameterNode implementation wrapping a pugi::xml_node.

Traditionally the node in question is the <Parameters> node in the XML-formatted network definition loaded by XmlNetworkBuilder.

Parameters are stored as stringly-typed attributes on that node. Example: <Parameters apply_bias="true" features="256" kernel="1x1" padding="same" stride="1x1" />

This class is ABI-stable through the IParameterNode interface, but the constructor relies on pugixml container types and should not be called with an xml_node from another other loaded module.

Constructor & Destructor Documentation

◆ XmlParameterNode()

XmlParameterNode::XmlParameterNode ( pugi::xml_node  node)
explicit

Creates an XmlParameterNode.

The XML document that controls the node must not be destroyed before the final reference to this XmlParameterNode is released.

Parameters
nodeNode to wrap

Member Function Documentation

◆ getDimension()

NeuralResult XmlParameterNode::getDimension ( const char *  pParameterName,
TensorDimension pDimOut 
) const
noexcept

Retrieves a tensor dimension.

Tensor dimensions are stored as strings, and parsed using TensorDimensionToString as described in CoreHelpers.h. The IMAGE mode is used for parsing; use getString and parse manually if you require tensor ordering. Almost all persisted dimensions in existing networks are parsed using IMAGE mode; when porting Creo Neural code, this is probably what you need.

Parameters
pParameterNameName of parameter to query
pDimOutPointer to a variable receiving the parameter value

◆ getFloat()

NeuralResult XmlParameterNode::getFloat ( const char *  pParameterName,
float *  pFloatOut 
) const
noexcept

Retrieves a floating-point value.

Parameters
pParameterNameName of parameter to query
pFloatOutPointer to a variable receiving the parameter value.

◆ getInteger()

NeuralResult XmlParameterNode::getInteger ( const char *  pParameterName,
int32_t *  pIntOut 
) const
noexcept

Retrieves a signed integer value.

Parameters
pParameterNameName of parameter to query
pIntOutPointer to a variable receiving the parameter value.

◆ getSize()

NeuralResult XmlParameterNode::getSize ( const char *  pParameterName,
size_t *  pSizeOut 
) const
noexcept

Retrieves an unsigned integer value that can represent the result of sizeof().

Parameters
pParameterNameName of parameter to query
pSizeOutPointer to a variable receiving the parameter value.

◆ getString()

NeuralResult XmlParameterNode::getString ( const char *  pParameterName,
const char **  pStringOut 
) const
noexcept

Retrieves a UTF-8 string value.

Parameters
pParameterNameName of parameter to query
pStringOutPointer to a variable receiving the parameter value.

◆ setDimension()

NeuralResult XmlParameterNode::setDimension ( const char *  pParameterName,
TensorDimension  value 
)
noexcept

Saves a tensor dimension.

Parameters
pParameterNameName of parameter to set
valueValue to save

◆ setFloat()

NeuralResult XmlParameterNode::setFloat ( const char *  pParameterName,
float  value 
)
noexcept

Saves a floating-point value.

Parameters
pParameterNameName of parameter to set
valueValue to save

◆ setInteger()

NeuralResult XmlParameterNode::setInteger ( const char *  pParameterName,
int32_t  value 
)
noexcept

Saves an integer.

Parameters
pParameterNameName of parameter to set
valueValue to save

◆ setSize()

NeuralResult XmlParameterNode::setSize ( const char *  pParameterName,
size_t  value 
)
noexcept

Saves an unsigned integer that can represent the result of sizeof().

Parameters
pParameterNameName of parameter to set
valueValue to save

◆ setString()

NeuralResult XmlParameterNode::setString ( const char *  pParameterName,
const char *  pString 
)
noexcept

Saves a UTF-8 string value.

Parameters
pParameterNameName of parameter to set
pStringValue to save

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