NVIDIA NvNeural SDK  2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
nvneural::WeightsData< TVectorData > Class Template Reference

Standard IWeightsData implementation containing a vector of values in CPU memory. More...

#include <WeightsData.h>

Inheritance diagram for nvneural::WeightsData< TVectorData >:
nvneural::refobj::RefObjectBase< refobj::Implements< IWeightsData > >

Public Member Functions

NetworkBackendId backendId () const noexcept
 Returns the backend for which this weights data is relevant. More...
 
const void * data () const noexcept
 Returns a pointer to the first element of the weights buffer. More...
 
TensorDimension dimension () const noexcept
 Returns the size of the weights buffer in elements. More...
 
bool memManagedExternally () const noexcept
 Returns true if the memory is managed outside NvNeural and should not be freed or reallocated by the framework. More...
 
TensorFormat tensorFormat () const noexcept
 Returns the tensor format for the weights buffer. More...
 
 WeightsData (TensorFormat format, TensorDimension dimension, std::vector< TVectorData > &&container)
 Creates a new WeightsData object. More...
 
- Public Member Functions inherited from nvneural::refobj::RefObjectBase< refobj::Implements< IWeightsData > >
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

template<typename TVectorData>
class nvneural::WeightsData< TVectorData >

Standard IWeightsData implementation containing a vector of values in CPU memory.

Typical weights loader implementations will move the data vector into this object.

Template Parameters
TVectorDataElement type contained in the vector

Constructor & Destructor Documentation

◆ WeightsData()

template<typename TVectorData >
WeightsData::WeightsData ( TensorFormat  format,
TensorDimension  dimension,
std::vector< TVectorData > &&  container 
)

Creates a new WeightsData object.

Parameters
formatTensor format (data type and layout); type is not inferred from the container parameter
dimensionTensor dimension of the weights data
containerRvalue reference to vector storage containing the entire weights tensor

Member Function Documentation

◆ backendId()

template<typename TVectorData >
NetworkBackendId WeightsData::backendId
noexcept

Returns the backend for which this weights data is relevant.

◆ data()

template<typename TVectorData >
const void * WeightsData::data
noexcept

Returns a pointer to the first element of the weights buffer.

The address space for this pointer depends on the backend:

  • Cpu: Pointer is in CPU memory.
  • Cuda: Pointer is a CUdeviceptr.

◆ dimension()

template<typename TVectorData >
TensorDimension WeightsData::dimension
noexcept

Returns the size of the weights buffer in elements.

◆ memManagedExternally()

template<typename TVectorData >
bool WeightsData::memManagedExternally
noexcept

Returns true if the memory is managed outside NvNeural and should not be freed or reallocated by the framework.

◆ tensorFormat()

template<typename TVectorData >
TensorFormat WeightsData::tensorFormat
noexcept

Returns the tensor format for the weights buffer.


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