23.02.1
|
Basic function to compute a Fully Connected layer. More...
#include <NEFullyConnectedLayer.h>
Public Member Functions | |
NEFullyConnectedLayer (std::shared_ptr< IMemoryManager > memory_manager=nullptr, IWeightsManager *weights_manager=nullptr) | |
Constructor. More... | |
NEFullyConnectedLayer (const NEFullyConnectedLayer &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
NEFullyConnectedLayer (NEFullyConnectedLayer &&)=delete | |
Prevent instances of this class from being moved (As this class contains pointers) More... | |
NEFullyConnectedLayer & | operator= (const NEFullyConnectedLayer &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
NEFullyConnectedLayer & | operator= (NEFullyConnectedLayer &&)=delete |
Prevent instances of this class from being moved (As this class contains pointers) More... | |
~NEFullyConnectedLayer () | |
Default destructor. More... | |
void | configure (const ITensor *input, const ITensor *weights, const ITensor *biases, ITensor *output, FullyConnectedLayerInfo fc_info=FullyConnectedLayerInfo(), const WeightsInfo &weights_info=WeightsInfo()) |
Set the input and output tensors. More... | |
void | run () override |
Run the kernels contained in the function. More... | |
void | prepare () override |
Prepare the function for executing. More... | |
![]() | |
virtual | ~IFunction ()=default |
Destructor. More... | |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, FullyConnectedLayerInfo fc_info=FullyConnectedLayerInfo(), const WeightsInfo &weights_info=WeightsInfo()) |
Static function to check if given info will lead to a valid configuration of NEFullyConnectedLayer. More... | |
static Status | has_opt_impl (arm_compute::WeightFormat &expected_weight_format, const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const FullyConnectedLayerInfo &fc_info, const WeightsInfo &weights_info) |
Static function that queries whether fixed-format kernel exists for a given problem description. More... | |
Basic function to compute a Fully Connected layer.
This function calls the following kernels:
are_weights_reshaped
is set to false and transpose_weights is set to true ) (called once)biases
is not equal to nullptr)Definition at line 86 of file NEFullyConnectedLayer.h.
NEFullyConnectedLayer | ( | std::shared_ptr< IMemoryManager > | memory_manager = nullptr , |
IWeightsManager * | weights_manager = nullptr |
||
) |
Constructor.
Definition at line 56 of file NEFullyConnectedLayer.cpp.
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
delete |
Prevent instances of this class from being moved (As this class contains pointers)
|
default |
Default destructor.
void configure | ( | const ITensor * | input, |
const ITensor * | weights, | ||
const ITensor * | biases, | ||
ITensor * | output, | ||
FullyConnectedLayerInfo | fc_info = FullyConnectedLayerInfo() , |
||
const WeightsInfo & | weights_info = WeightsInfo() |
||
) |
Set the input and output tensors.
Valid data layouts:
Valid data type configurations:
src0 | src1 | src2 | dst |
---|---|---|---|
F16 | F16 | F16 | F16 |
F32 | F32 | F32 | F32 |
QASYMM8 | QASYMM8 | S32 | QASYMM8 |
QASYMM8_SIGNED | QASYMM8_SIGNED | S32 | QASYMM8_SIGNED |
[in] | input | Source tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/F16/F32. |
[in] | weights | Weights tensor. The weights must be 2 dimensional. If this function is called after a Convolution Layer, the (transposed) weights will have as many rows as the product of the first 3 input's dimensions. If it is called after another FullyConnected Layer, the (transposed) weights will have as many rows as the input's first dimension. Data type supported: Same as input . |
[in] | biases | Bias tensor. Can be nullptr. Data type supported: Same as weights , S32 if weights is QASYMM8/QASYMM8_SIGNED. |
[out] | output | Destination tensor. Its shape should be equal to the output of a matrix multiplication between:
|
[in] | fc_info | (Optional) Fully connected layer additional info |
[in] | weights_info | (Optional) Stores neccessary compute information when weights are already reshaped |
Definition at line 63 of file NEFullyConnectedLayer.cpp.
References arm_compute::ACL_DST, arm_compute::ACL_SRC_0, arm_compute::ACL_SRC_1, arm_compute::ACL_SRC_2, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ARM_COMPUTE_LOG_PARAMS, ITensor::info(), NEFullyConnectedLayer::validate(), and arm_compute::test::validation::weights_info.
Referenced by NERNNLayer::configure(), and NELSTMLayer::configure().
|
static |
Static function that queries whether fixed-format kernel exists for a given problem description.
[out] | expected_weight_format | Format in which weights should be for found fixed format kernel |
[in] | input | Source tensor |
[in] | weights | Weights tensor. |
[in] | biases | Bias tensor. Can be nullptr. Data type supported: Same as weights , S32 if weights is QASYMM8/QASYMM8_SIGNED. |
[in] | output | Destination tensor |
[in] | fc_info | Fully connected layer additional info |
[in] | weights_info | Describes weights shape |
Definition at line 92 of file NEFullyConnectedLayer.cpp.
References CpuFullyConnected::has_opt_impl().
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
delete |
Prevent instances of this class from being moved (As this class contains pointers)
|
overridevirtual |
Prepare the function for executing.
Any one off pre-processing step required by the function is handled here
Reimplemented from IFunction.
Definition at line 113 of file NEFullyConnectedLayer.cpp.
References ITensor::is_used().
Referenced by NERNNLayer::prepare(), and NEFullyConnectedLayer::run().
|
overridevirtual |
Run the kernels contained in the function.
For CPU kernels:
For OpenCL kernels:
Implements IFunction.
Definition at line 105 of file NEFullyConnectedLayer.cpp.
References NEFullyConnectedLayer::prepare().
Referenced by NERNNLayer::run(), and NELSTMLayer::run().
|
static |
Static function to check if given info will lead to a valid configuration of NEFullyConnectedLayer.
Similar to NEFullyConnectedLayer::configure()
Definition at line 99 of file NEFullyConnectedLayer.cpp.
References CpuFullyConnected::validate().
Referenced by NEFullyConnectedLayer::configure(), arm_compute::test::validation::DATA_TEST_CASE(), NERNNLayer::validate(), and NELSTMLayer::validate().