26 #ifndef NVNEURAL_LAYERTYPES_H
27 #define NVNEURAL_LAYERTYPES_H
72 virtual const char*
name() const noexcept = 0;
318 virtual
NeuralResult setInnerActivationCoefficient(std::
size_t coefficientIndex,
float value) noexcept = 0;
325 virtual
float innerActivationCoefficient(std::
size_t coefficientIndex) const noexcept = 0;
391 virtual
NeuralResult getTensorWriteOffset(const
ILayer* pInput, std::
size_t* pOffsetOut) const noexcept = 0;
438 virtual
NeuralResult copyStatusMessage(
char* pBuffer, std::
size_t bufferSize) noexcept = 0;
453 namespace runtimeoptionstype
467 namespace runtimeoptionsattributes
469 const char*
const list =
"list";
470 const char*
const min =
"min";
471 const char*
const max =
"max";
472 const char*
const step =
"step";
530 virtual const
char* runtimeOptionByIndex(
size_t index) const noexcept = 0;
553 virtual
NeuralResult setRuntimeOptionValue(const
char* pName, const
char* pValue) noexcept = 0;
558 virtual const
char* getRuntimeOptionValue(const
char* pName) const noexcept = 0;
Fundamental NvNeural data types are declared here.
NetworkBackendId
Enumeration describing common network backends.
Definition: CoreTypes.h:239
ActivationFunctionId
Enumeration describing common activation functions.
Definition: CoreTypes.h:259
NeuralResult
NeuralResult is a generic success/failure result type similar to COM HRESULT.
Definition: CoreTypes.h:275
WeightsQuery
WeightsQuery describes the different types of queries for weights data.
Definition: LayerTypes.h:39
@ Aligned
Represents the "actual" dimensions expected from compatible weights.
@ Required
Represents the "official" dimensions expected from compatible weights.
IBypassLayer is an optional interface that marks a layer as one that can potentially forward its inpu...
Definition: LayerTypes.h:405
virtual const ILayer * getAliasedInput() const noexcept=0
Returns the input layer that should be aliased from this layer or nullptr if this layer cannot be byp...
IConcatenationLayer2 is an optional interface implemented by layers that marks them as concatenation ...
Definition: LayerTypes.h:372
virtual bool allInputsSupportDirectTensorWrites() const noexcept=0
Tests whether all inputs to this layer can be replaced with direct writes.
IConcatenationLayer is an optional interface implemented by layers that marks them as concatenation l...
Definition: LayerTypes.h:343
virtual bool inputSupportsElision(size_t inputIndex, std::size_t *pElisionOffsetOut) const noexcept=0
If this layer supports elision, it calculates the appropriate offset for a given input.
IInnerActivationLayer is an optional interface implemented by layers that fuse pairs of operations.
Definition: LayerTypes.h:300
virtual ActivationFunctionId innerActivationFunction() const noexcept=0
Retrieves the activation function attached to this layer.
virtual NeuralResult setInnerActivationFunction(ActivationFunctionId activationFunction) noexcept=0
Sets the inner activation function.
ILayer is the base class for neural network layers.
Definition: LayerTypes.h:59
virtual bool isAffected() const noexcept=0
Returns the current status of the "affected" flag.
virtual std::size_t tensorInternalBufferSize() const noexcept=0
Retrieves the dimensions of the layer's output tensor as allocated internally.
virtual NeuralResult getCpuConstData(void *pOutBuffer, size_t bufferByteCount, size_t *pBytesCopied, TensorFormat format) const noexcept=0
Retrieves read-only CPU-side memory for the layer's output.
virtual bool isPermanent() const noexcept=0
Returns the current status of the "permanent" flag.
virtual NeuralResult setActivationCoefficient(std::size_t coefficientIndex, float value) noexcept=0
Sets an activation coefficient.
virtual NeuralResult setAffected(bool affected) noexcept=0
Sets or clears the "affected" flag on a layer's output tensor.
virtual NeuralResult evaluateForward() noexcept=0
Performs forward evaluation for this layer.
virtual std::size_t tensorBufferSize() const noexcept=0
Retrieve the size of the layer's output tensor buffer in bytes.
virtual ActivationFunctionId activationFunction() const noexcept=0
Retrieves the activation function attached to this layer.
virtual const char * weightsName() const noexcept=0
Retrieves the name used to identify this layer's weights.
virtual TensorDimension dimensions() const noexcept=0
Retrieves the dimensions of the layer's output tensor.
virtual NeuralResult setWeightsName(const char *pWeightsName) noexcept=0
Sets the name used to identify this layer's weights.
virtual NetworkBackendId backendId() const noexcept=0
Returns the backend ID associated with this layer implementation.
virtual NeuralResult setInputLayer(std::size_t index, ILayer *pLayer) noexcept=0
Sets an input layer by index.
virtual NeuralResult setNetworkRuntime(INetworkRuntime *pNetworkRuntime) noexcept=0
Informs the layer it has been attached to a new network.
virtual TensorDimension weightsDimensions(const char *pWeightsName, WeightsQuery queryType) const noexcept=0
Retrieves the tensor dimension of a layer's named weight input.
virtual float activationCoefficient(std::size_t coefficientIndex) const noexcept=0
Retrieves the activation coefficient for the specified index.
virtual const char * serializedType() const noexcept=0
Retrieves the layer type.
virtual NeuralResult loadFromParameters(const IParameterNode *pParameters) noexcept=0
Loads layer parameters from a serialized key-value representation.
virtual const char * name() const noexcept=0
Retrieves the layer name.
virtual NeuralResult setName(const char *pName) noexcept=0
Sets the layer name.
virtual NeuralResult setPermanent(bool permanent) noexcept=0
Sets or clears the "permanent" flag on a layer's output tensor.
virtual TensorDimension stepping() const noexcept=0
Returns the internal storage stride consumed by this layer implementation.
virtual TensorFormat tensorFormat() const noexcept=0
Returns the tensor format consumed by this layer implementation.
virtual NeuralResult getInputLayers(ILayerList **ppInputLayers) const noexcept=0
Retrieves the inputs for this layer.
static const IRefObject::TypeId typeID
Interface TypeId for InterfaceOf purposes.
Definition: LayerTypes.h:62
virtual NeuralResult getData(void **ppOut, TensorFormat format, const ILayer *pRequestingLayer) noexcept=0
Retrieves device-side memory for the layer's output.
virtual NeuralResult getConstData(const void **ppOut, TensorFormat format, const ILayer *pRequestingLayer) const noexcept=0
Retrieves read-only device-side memory for the layer's output.
virtual NeuralResult reshape() noexcept=0
Initializes (or reinitializes) the layer implementation with the current set of parameters.
virtual TensorDimension internalDimensions() const noexcept=0
Retrieves the dimensions of the layer's output tensor as allocated internally.
virtual NeuralResult setActivationFunction(ActivationFunctionId activationFunction) noexcept=0
Sets the activation function attached to the layer.
ILayerList represents an immutable collection of ILayer pointers.
Definition: CoreTypes.h:1060
INetworkRuntime is a subset of the basic network interface that is accessible from layer classes duri...
Definition: CoreTypes.h:1129
Represents a serialized parameter block in a model definition.
Definition: CoreTypes.h:1889
Base class for all objects, similar to COM's IUnknown.
Definition: CoreTypes.h:343
std::uint64_t TypeId
Every interface must define a unique TypeId. This should be randomized.
Definition: CoreTypes.h:349
IRuntimeOptionsHost is an interface that provides runtime option communication from the layer to the ...
Definition: CoreTypes.h:544
IRuntimeOptionsLayer is an optional interface that marks a layer as one that uses runtime options.
Definition: LayerTypes.h:498
virtual std::size_t runtimeOptionCount() const noexcept=0
Returns the number of available runtime options.
IStatusMessageLayer is an optional interface intended for ILayer to provide status messages.
Definition: LayerTypes.h:420
virtual std::size_t nextStatusMessageSize() const noexcept=0
Returns the size of the next status message including trailing null.
const char *const max
Defines a max value, ex. "max":"1" or "max":"1.0".
Definition: LayerTypes.h:471
const char *const list
Defines a list of string, ex. "list":["option_1", "option_2"].
Definition: LayerTypes.h:469
const char *const step
Defines a step value, ex. "step":"1" or "step":"0.5".
Definition: LayerTypes.h:472
const char *const min
Defines a min value, ex. "min":"0" or "min":"0.5".
Definition: LayerTypes.h:470
const char *const numfloat
Requires nothing, sent float.
Definition: LayerTypes.h:456
const char *const trigger
Requires nothing, sent empty string.
Definition: LayerTypes.h:461
const char *const booltf
Requires nothing, sent "true" or "false".
Definition: LayerTypes.h:458
const char *const numint
Requires nothing, sent int.
Definition: LayerTypes.h:457
const char *const textlabel
Requires nothing, sent nothing, send string.
Definition: LayerTypes.h:459
const char *const stringlist
Requires runtimeoptionsattributes::list, sent ordinal.
Definition: LayerTypes.h:455
const char *const textedit
Requires nothing, sent string.
Definition: LayerTypes.h:460
TensorDimension describes the dimensions of a four-dimensional image tensor.
Definition: CoreTypes.h:136