26 #ifndef NVNEURAL_CLASSREGISTRY_H 
   27 #define NVNEURAL_CLASSREGISTRY_H 
   46     struct OpaqueClassRegistration;
 
  116         template<typename TObject>
 
  129         template<
typename TObject>
 
  134             return registerObjectClass<TObject>(layerDesc.
pObjectClass);
 
  144         template<
typename TObject>
 
  149             return registerObjectClass<TObject>(activationDesc.
pObjectClass);
 
  160         template<
typename TObject>
 
  164             return registerObjectClass<TObject>(prototypeDesc.
pObjectClass);
 
  204         void loadStaticRegistrations();
 
  206         bool registerImportedActivationDesc(
const ActivationDesc* pImportedActivationDesc);
 
  207         bool registerImportedLayerDesc(
const LayerDesc* pImportedLayerDesc);
 
  208         bool registerImportedPrototypeDesc(
const PrototypeDesc* pImportPrototypeDesc);
 
  210         std::vector<RefPtr<IPlugin>> m_loadedPlugins;
 
  212         std::vector<ActivationDescHostContainer> m_exportedActivationHostContainers;
 
  213         std::vector<LayerDescHostContainer> m_exportedLayerHostContainers;
 
  214         std::vector<PrototypeDescHostContainer> m_exportedPrototypeHostContainers;
 
  216         std::vector<const ActivationDesc*> m_exportedActivations;
 
  217         std::vector<const LayerDesc*> m_exportedLayers;
 
  218         std::vector<const FusingRule*> m_exportedFusingRules;
 
  219         std::vector<const PrototypeDesc*> m_exportedPrototypes;
 
  221         std::map<std::string, CreationFunction> m_objectTypes;
 
  222         std::map<std::string, PrototypeRuntimeValidatorFunction> m_exportedPrototypeRuntimeValidators;
 
describes a container that has the imported ActivationDesc in terms of the host's version.
 
OpaqueClassRegistration * OpaqueClassRegistrationHandle
Opaque return type from registration functions.
Definition: ClassRegistry.h:52
 
Common helper classes and template function implementations.
 
Fundamental NvNeural data types are declared here.
 
NeuralResult
NeuralResult is a generic success/failure result type similar to COM HRESULT.
Definition: CoreTypes.h:275
 
describes a container that has the imported LayerDesc in terms of the host's version.
 
describes a container that has the imported PrototypeDesc in terms of the host's version.
 
Standard implementation for IRefObject-derived objects.
 
ClassRegistry is the default implementation for IClassRegistry.
Definition: ClassRegistry.h:72
 
const ActivationDesc * exportedActivationByIndex(std::size_t index) const noexcept final
Returns a registered activation function descriptor for a given index.
Definition: ClassRegistry.cpp:210
 
static OpaqueClassRegistrationHandle registerObjectClass(const char *pObjectClass)
Registers a C++ object as a factory-creatable object class.
Definition: ClassRegistry.h:117
 
const PrototypeDesc * exportedPrototypeByIndex(std::size_t index) const noexcept final
Returns a registered prototype layer descriptor for a given index.
Definition: ClassRegistry.cpp:273
 
static OpaqueClassRegistrationHandle registerLayerDesc(const LayerDesc *pLayerDesc)
Registers a LayerDesc structure for discovery.
Definition: ClassRegistry.cpp:358
 
static OpaqueClassRegistrationHandle registerActivation(const ActivationDesc &activationDesc)
Registers a C++ object and ActivationDesc structure for discovery and creation.
Definition: ClassRegistry.h:145
 
NeuralResult createObject(IRefObject **ppOut, const char *pObjectClass) const noexcept final
Creates the designated object using its manifest-specified class name.
Definition: ClassRegistry.cpp:304
 
static OpaqueClassRegistrationHandle registerPrototypeDesc(const PrototypeDesc *pPrototypeDesc, PrototypeRuntimeValidatorFunction runtimeValidator)
Registers a PrototypeDesc structure and validator for discovery.
Definition: ClassRegistry.cpp:374
 
std::size_t exportedFusingRulesCount() const noexcept final
Returns the count of registered fusing rules.
Definition: ClassRegistry.cpp:246
 
static OpaqueClassRegistrationHandle registerPrototype(const PrototypeDesc &prototypeDesc, PrototypeRuntimeValidatorFunction runtimeValidator)
Registers a C++ object as a prototype layer for discovery and creation.
Definition: ClassRegistry.h:161
 
static OpaqueClassRegistrationHandle registerLayer(const LayerDesc &layerDesc)
Registers a C++ object and LayerDesc structure for discovery and creation.
Definition: ClassRegistry.h:130
 
std::size_t exportedPrototypesCount() const noexcept final
Returns the count of registered prototype layers.
Definition: ClassRegistry.cpp:267
 
ClassRegistry()
Creates a new ClassRegistry containing statically-registered descriptors and object classes.
Definition: ClassRegistry.cpp:90
 
PrototypeRuntimeValidatorFunction exportedPrototypeRuntimeValidatorByIndex(std::size_t index) const noexcept final
Returns the runtime validator of a registered prototype layer for a given index.
Definition: ClassRegistry.cpp:288
 
NeuralResult importPluginLoader(IPluginLoader *pPluginLoader) final
Imports all plugins loaded by a plugin loader.
Definition: ClassRegistry.cpp:182
 
static OpaqueClassRegistrationHandle registerObjectClassInternal(const char *pObjectClass, CreationFunction classFactory)
Registers an object class and associated creation function.
Definition: ClassRegistry.cpp:330
 
NeuralResult importPlugin(IPlugin *pPlugin) final
Imports everything (layer, activation, fusing rules, and prototypes) registered with a single plugin.
Definition: ClassRegistry.cpp:99
 
const LayerDesc * exportedLayerByIndex(std::size_t index) const noexcept final
Returns a registered layer descriptor for a given index.
Definition: ClassRegistry.cpp:231
 
IRefObject *(*)() CreationFunction
Typedef for factory functions that take no arguments and return a new IRefObject.
Definition: ClassRegistry.h:75
 
~ClassRegistry()
Destroys the ClassRegistry.
Definition: ClassRegistry.cpp:95
 
const FusingRule * exportedFusingRuleByIndex(std::size_t index) const noexcept final
Returns a registered fusing rule for a given index.
Definition: ClassRegistry.cpp:252
 
std::size_t exportedLayersCount() const noexcept final
Returns the count of registered layers.
Definition: ClassRegistry.cpp:225
 
std::size_t exportedActivationsCount() const noexcept final
Returns the count of registered activation functions.
Definition: ClassRegistry.cpp:204
 
bool isPrototypeRuntimeCompatible(const char *pPrototypeObjectClass, const INetwork *pNetwork) const final
Checks if the given prototype object class is compatible with any of the registered prototypes.
Definition: ClassRegistry.cpp:482
 
static OpaqueClassRegistrationHandle registerActivationDesc(const ActivationDesc *pActivationDesc)
Registers an ActivationDesc structure for discovery.
Definition: ClassRegistry.cpp:342
 
static OpaqueClassRegistrationHandle registerFusingRule(std::uint32_t syntaxVersion, const char *pFusingRule)
Register a fusing rule for export.
Definition: ClassRegistry.cpp:336
 
INetwork is the public interface to Network.
Definition: NetworkTypes.h:119
 
IPlugin is the general factory interface used by NvNeural's plugin system.
Definition: PluginTypes.h:41
 
Platform-agnostic plugin loader interface.
Definition: PluginTypes.h:200
 
Base class for all objects, similar to COM's IUnknown.
Definition: CoreTypes.h:343
 
Structure describing an activation function (IActivationFunction) for tool interfaces and network bui...
Definition: CoreTypes.h:1584
 
const char * pObjectClass
This is the programmatic class name used to instantiate the activation object through the IPlugin::cr...
Definition: CoreTypes.h:1594
 
Defines a fusing rule that can be applied during model loading.
Definition: CoreTypes.h:1731
 
This structure describes an ILayer for tools and network builders.
Definition: CoreTypes.h:1504
 
const char * pObjectClass
This is the programmatic class name used to instantiate the layer object through the IPlugin::createO...
Definition: CoreTypes.h:1516
 
This structure represent a prototype layer version (backend, tensor format and kernel type),...
Definition: CoreTypes.h:1647
 
const char * pObjectClass
This is the programmatic class name used to instantiate the prototype object through the IPlugin::cre...
Definition: CoreTypes.h:1657
 
Parameterized base class implementing common IRefObject operations.
Definition: RefObject.h:336