@Namespace(value="nvinfer1") @NoOffset @Properties(inherit=nvinfer.class) public class IFullyConnectedLayer extends ILayer
MxV
tensor X
, where V
is a product of the last three dimensions and M
is a product of the remaining dimensions (where the product over 0 dimensions is defined as 1). For example:
- If the input tensor has shape {C, H, W}
, then the tensor is reshaped into {1, C*H*W}
.
- If the input tensor has shape {P, C, H, W}
, then the tensor is reshaped into {P, C*H*W}
.
The layer then performs the following operation:
~~~
Y := matmul(X, W^T) + bias
~~~
Where X
is the MxV
tensor defined above, W
is the KxV
weight tensor
of the layer, and bias
is a row vector size K
that is broadcasted to
MxK
. K
is the number of output channels, and configurable via
setNbOutputChannels(). If bias
is not specified, it is implicitly 0
.
The MxK
result Y
is then reshaped such that the last three dimensions are {K, 1, 1}
and
the remaining dimensions match the dimensions of the input tensor. For example:
- If the input tensor has shape {C, H, W}
, then the output tensor will have shape {K, 1, 1}
.
- If the input tensor has shape {P, C, H, W}
, then the output tensor will have shape {P, K, 1, 1}
.
\warning Do not inherit from this class, as doing so will break forward-compatibility of the API and ABI.Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
IFullyConnectedLayer(Pointer p)
Deprecated.
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
Weights |
getBiasWeights()
Deprecated.
\brief Get the bias weights.
|
Weights |
getKernelWeights()
Deprecated.
\brief Get the kernel weights.
|
int |
getNbOutputChannels()
Deprecated.
\brief Get the number of output channels
K from the fully connected layer. |
void |
setBiasWeights(Weights weights)
Deprecated.
\brief Set the bias weights.
|
void |
setKernelWeights(Weights weights)
Deprecated.
\brief Set the kernel weights, given as a
KxC matrix in row-major order. |
void |
setNbOutputChannels(int nbOutputs)
Deprecated.
\brief Set the number of output channels
K from the fully connected layer. |
getInput, getMetadata, getName, getNbInputs, getNbOutputs, getOutput, getOutputType, getPrecision, getType, outputTypeIsSet, precisionIsSet, resetOutputType, resetPrecision, setInput, setMetadata, setMetadata, setName, setName, setOutputType, setOutputType, setPrecision, setPrecision
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public IFullyConnectedLayer(Pointer p)
Pointer(Pointer)
.@NoException(value=true) public void setNbOutputChannels(int nbOutputs)
K
from the fully connected layer.
If executing this layer on DLA, number of output channels must in the range [1,8192].getNbOutputChannels()
@NoException(value=true) public int getNbOutputChannels()
K
from the fully connected layer.setNbOutputChannels()
@NoException(value=true) public void setKernelWeights(@ByVal Weights weights)
KxC
matrix in row-major order.getKernelWeights()
@ByVal @NoException(value=true) public Weights getKernelWeights()
setKernelWeights()
@NoException(value=true) public void setBiasWeights(@ByVal Weights weights)
getBiasWeightsWeights()
@ByVal @NoException(value=true) public Weights getBiasWeights()
setBiasWeightsWeights()
Copyright © 2024. All rights reserved.