NVIDIA NvNeural SDK  2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
nvneural::IClassRegistry Class Referenceabstract

Common class registry for instantiating objects and collecting plugin-provided descriptors. More...

#include <nvneural/CoreTypes.h>

Inheritance diagram for nvneural::IClassRegistry:
nvneural::IRefObject

Public Member Functions

virtual NeuralResult createObject (IRefObject **ppOut, const char *pObjectClass) const noexcept=0
 Creates the designated object using its manifest-specified class name. More...
 
virtual const ActivationDescexportedActivationByIndex (std::size_t index) const noexcept=0
 Returns a registered activation function descriptor for a given index. More...
 
virtual std::size_t exportedActivationsCount () const noexcept=0
 Returns the count of registered activation functions.
 
virtual const FusingRuleexportedFusingRuleByIndex (std::size_t index) const noexcept=0
 Returns a registered fusing rule for a given index. More...
 
virtual std::size_t exportedFusingRulesCount () const noexcept=0
 Returns the count of registered fusing rules.
 
virtual const LayerDescexportedLayerByIndex (std::size_t index) const noexcept=0
 Returns a registered layer descriptor for a given index. More...
 
virtual std::size_t exportedLayersCount () const noexcept=0
 Returns the count of registered layers.
 
virtual const PrototypeDescexportedPrototypeByIndex (std::size_t index) const noexcept=0
 Returns a registered prototype layer descriptor for a given index. More...
 
virtual PrototypeRuntimeValidatorFunction exportedPrototypeRuntimeValidatorByIndex (std::size_t index) const noexcept=0
 Returns the runtime validator of a registered prototype layer for a given index. More...
 
virtual std::size_t exportedPrototypesCount () const noexcept=0
 Returns the count of registered prototype layers.
 
virtual NeuralResult importPlugin (IPlugin *pPlugin)=0
 Imports everything (layer, activation, fusing rules, and prototypes) registered with a single plugin. More...
 
virtual NeuralResult importPluginLoader (IPluginLoader *pPluginLoader)=0
 Imports all plugins loaded by a plugin loader. More...
 
virtual bool isPrototypeRuntimeCompatible (const char *pPrototypeObjectClass, const INetwork *pNetwork) const =0
 Checks if the given prototype object class is compatible with any of the registered prototypes. More...
 
- Public Member Functions inherited from nvneural::IRefObject
virtual RefCount addRef () const noexcept=0
 Increments the object's reference count. More...
 
virtual const void * queryInterface (TypeId interface) const noexcept=0
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual void * queryInterface (TypeId interface) noexcept=0
 Retrieves a new object interface pointer. More...
 
virtual RefCount release () const noexcept=0
 Decrements the object's reference count and destroy the object if the reference count reaches zero. More...
 

Static Public Attributes

static const IRefObject::TypeId typeID = 0x261ae312ee3c4979ul
 Interface TypeId for InterfaceOf purposes.
 
- Static Public Attributes inherited from nvneural::IRefObject
static const TypeId typeID = 0x14ecc3f9de638e1dul
 Interface TypeId for InterfaceOf purposes.
 

Additional Inherited Members

- Public Types inherited from nvneural::IRefObject
using RefCount = std::uint32_t
 Typedef used to track the number of active references to an object.
 
using TypeId = std::uint64_t
 Every interface must define a unique TypeId. This should be randomized.
 
- Protected Member Functions inherited from nvneural::IRefObject
virtual ~IRefObject ()=default
 A protected destructor prevents accidental stack-allocation of IRefObjects or use with other smart pointer classes like std::unique_ptr.
 

Detailed Description

Common class registry for instantiating objects and collecting plugin-provided descriptors.

As a host application, create a ClassRegistry and import your plugin loader into it. Network builders and similar classes will then be aware of all layers/activations/etc that were loaded by your plugins, and can create the described objects using createObject.

As a layer author, you should register the layer (or activation) for export by calling static methods on your class registry object. Pointers inside LayerDesc and similar objects need to remain valid for the lifetime of the plugin object–do not use temporaries here.

Member Function Documentation

◆ createObject()

virtual NeuralResult nvneural::IClassRegistry::createObject ( IRefObject **  ppOut,
const char *  pObjectClass 
) const
pure virtualnoexcept

Creates the designated object using its manifest-specified class name.

Parameters
ppOutReceives a pointer to a newly created object, or nullptr if the name is unknown or creation fails.
pObjectClassObject class name.
Note
For implementers: the newly created object should have a ref count of 1.

◆ exportedActivationByIndex()

virtual const ActivationDesc* nvneural::IClassRegistry::exportedActivationByIndex ( std::size_t  index) const
pure virtualnoexcept

Returns a registered activation function descriptor for a given index.

Parameters
index0-based index to an activation function
Returns
A pointer to ActivationDesc that will remain valid through the lifespan of this object, or nullptr if index is out of bounds.

◆ exportedFusingRuleByIndex()

virtual const FusingRule* nvneural::IClassRegistry::exportedFusingRuleByIndex ( std::size_t  index) const
pure virtualnoexcept

Returns a registered fusing rule for a given index.

Parameters
index0-based index to a fusing ruler
Returns
A pointer to FusingRule that will remain valid through the lifespan of this object, or nullptr if index is out of bounds.

◆ exportedLayerByIndex()

virtual const LayerDesc* nvneural::IClassRegistry::exportedLayerByIndex ( std::size_t  index) const
pure virtualnoexcept

Returns a registered layer descriptor for a given index.

Parameters
index0-based index to a layer
Returns
A pointer to LayerDesc that will remain valid through the lifespan of this object, or nullptr if index is out of bounds.

◆ exportedPrototypeByIndex()

virtual const PrototypeDesc* nvneural::IClassRegistry::exportedPrototypeByIndex ( std::size_t  index) const
pure virtualnoexcept

Returns a registered prototype layer descriptor for a given index.

Parameters
index0-based index to a prototype layer
Returns
A pointer to PrototypeDesc that will remain valid through the lifespan of this object, or nullptr if index is out of bounds.

◆ exportedPrototypeRuntimeValidatorByIndex()

virtual PrototypeRuntimeValidatorFunction nvneural::IClassRegistry::exportedPrototypeRuntimeValidatorByIndex ( std::size_t  index) const
pure virtualnoexcept

Returns the runtime validator of a registered prototype layer for a given index.

Parameters
index0-based index to a prototype layer
Returns
A function of PrototypeRuntimeValidatorFunction that will remain valid through the lifespan of this object, or nullptr if index is out of bounds.

◆ importPlugin()

virtual NeuralResult nvneural::IClassRegistry::importPlugin ( IPlugin pPlugin)
pure virtual

Imports everything (layer, activation, fusing rules, and prototypes) registered with a single plugin.

Parameters
pPluginA plugin enumerated by a plugin loader
Returns
Always success as this function does not expect any failure

◆ importPluginLoader()

virtual NeuralResult nvneural::IClassRegistry::importPluginLoader ( IPluginLoader pPluginLoader)
pure virtual

Imports all plugins loaded by a plugin loader.

Equivalent to looping through the IPluginLoader calling importPlugin on each object.

Parameters
pPluginLoaderIPluginLoader with loaded plugins
Returns
Success if plugin loader is empty or all plugins loaded successfully, Failure if one or more had errors

◆ isPrototypeRuntimeCompatible()

virtual bool nvneural::IClassRegistry::isPrototypeRuntimeCompatible ( const char *  pPrototypeObjectClass,
const INetwork pNetwork 
) const
pure virtual

Checks if the given prototype object class is compatible with any of the registered prototypes.

Parameters
pPrototypeObjectClassA string specifying the prototype object class to be checked
pNetworkNetwork pointer needed for a prototype's runtime validator
Returns
True if the given prototype is compatible with one of the registered prototypes; False otherwise

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