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

Standard IWeightsLoader interface that loads weights from the local filesystem. More...

#include <FilesystemWeightsLoader.h>

Inheritance diagram for nvneural::FilesystemWeightsLoader:
nvneural::refobj::RefObjectBase< refobj::Implements< IFilesystemWeightsLoader >, refobj::Implements< IWeightsLoader > >

Public Member Functions

bool allowBinaryWeights () const noexcept
 Returns true if binary support is enabled. More...
 
bool allowNumpyWeights () const noexcept
 Returns true if NumPy support is enabled. More...
 
bool allowRandomWeights () const noexcept
 Returns true if random weights generation is enabled. More...
 
 FilesystemWeightsLoader (const std::string &weightsPrefix)
 Creates a weights loader that operates in a particular directory. More...
 
NeuralResult getWeightsForLayer (IWeightsData **ppWeightsDataOut, const INetworkRuntime *pNetwork, const ILayer *pLayer, const char *pName) const noexcept
 Retrieves a weights data buffer in a canonical format. More...
 
NeuralResult setAllowBinaryWeights (bool allowBinary) noexcept
 Turn binary support on or off. More...
 
NeuralResult setAllowNumpyWeights (bool allowNumpy) noexcept
 Turn NumPy support on or off. More...
 
NeuralResult setAllowRandomWeights (bool allowRandoms) noexcept
 Turn random weights generation on or off. More...
 
- Public Member Functions inherited from nvneural::refobj::RefObjectBase< refobj::Implements< IFilesystemWeightsLoader >, refobj::Implements< IWeightsLoader > >
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...
 

Protected Member Functions

 FilesystemWeightsLoader ()
 Default constructor that assigns no weights prefix. More...
 
void init (const std::string &weightsPrefix)
 Assigns a weights prefix and performs common initialization. More...
 

Detailed Description

Standard IWeightsLoader interface that loads weights from the local filesystem.

Applications should feel to augment or replace this class with domain-specific functionality.

Warning
This class does not use OS-level sandboxing. Security-critical operations should use a custom weights loader.

Constructor & Destructor Documentation

◆ FilesystemWeightsLoader() [1/2]

FilesystemWeightsLoader::FilesystemWeightsLoader ( const std::string &  weightsPrefix)
explicit

Creates a weights loader that operates in a particular directory.

Parameters
weightsPrefixPath string to prepend to generated weights filenames before loading

◆ FilesystemWeightsLoader() [2/2]

FilesystemWeightsLoader::FilesystemWeightsLoader ( )
protected

Default constructor that assigns no weights prefix.

Used by derived classes that can't call the ctor overload with an argument due to RefObjectBase. Such classes should call init() inside their own constructors.

Member Function Documentation

◆ allowBinaryWeights()

bool FilesystemWeightsLoader::allowBinaryWeights ( ) const
noexcept

Returns true if binary support is enabled.

◆ allowNumpyWeights()

bool FilesystemWeightsLoader::allowNumpyWeights ( ) const
noexcept

Returns true if NumPy support is enabled.

◆ allowRandomWeights()

bool FilesystemWeightsLoader::allowRandomWeights ( ) const
noexcept

Returns true if random weights generation is enabled.

◆ getWeightsForLayer()

NeuralResult FilesystemWeightsLoader::getWeightsForLayer ( IWeightsData **  ppWeightsDataOut,
const INetworkRuntime pNetwork,
const ILayer pLayer,
const char *  pName 
) const
noexcept

Retrieves a weights data buffer in a canonical format.

Parameters
ppWeightsDataOutPointer to a variable receiving the created IWeightsData object
pNetworkNetworkRuntime containing the layer
pLayerLayer to retrieve data for
pNameBuffer to retrieve

◆ init()

void FilesystemWeightsLoader::init ( const std::string &  weightsPrefix)
protected

Assigns a weights prefix and performs common initialization.

Parameters
weightsPrefixPath string to prepend to generated weights filenames before loading

◆ setAllowBinaryWeights()

NeuralResult FilesystemWeightsLoader::setAllowBinaryWeights ( bool  allowBinary)
noexcept

Turn binary support on or off.

◆ setAllowNumpyWeights()

NeuralResult FilesystemWeightsLoader::setAllowNumpyWeights ( bool  allowNumpy)
noexcept

Turn NumPy support on or off.

◆ setAllowRandomWeights()

NeuralResult FilesystemWeightsLoader::setAllowRandomWeights ( bool  allowRandoms)
noexcept

Turn random weights generation on or off.


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