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

ILayerList represents an immutable collection of ILayer pointers. More...

#include <nvneural/CoreTypes.h>

Inheritance diagram for nvneural::ILayerList:
nvneural::IRefObject

Public Member Functions

virtual ILayergetLayerByIndex (size_t layerIndex) const noexcept=0
 Returns the Nth ILayer pointer in the collection. More...
 
virtual size_t layerCount () const noexcept=0
 Returns the number of layers in this collection.
 
- 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 = 0x28d94b933a3b0dabul
 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

ILayerList represents an immutable collection of ILayer pointers.

This class exists to provide an ABI-stable wrapper for returning std::vector<ILayer*> sets, without the usual double-call pattern of "call function with null buffer, get required buffer size, call again with properly sized array" seen frequently in C APIs.

Implementations of this class should take references to their members. Doing so prevents the class from returning pointers to freed ILayer objects in getLayerByIndex.

Member Function Documentation

◆ getLayerByIndex()

virtual ILayer* nvneural::ILayerList::getLayerByIndex ( size_t  layerIndex) const
pure virtualnoexcept

Returns the Nth ILayer pointer in the collection.

Parameters
layerIndexZero-based index to retrieve
Returns
The Nth layer in the collection, or nullptr if layerIndex is out of bounds.

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