24.02.1
|
Basic function to compute a Fully Connected layer on OpenCL. More...
#include <CLFullyConnectedLayer.h>
Public Member Functions | |
CLFullyConnectedLayer (std::shared_ptr< IMemoryManager > memory_manager=nullptr, IWeightsManager *weights_manager=nullptr) | |
Constructor. More... | |
~CLFullyConnectedLayer () | |
Default destructor. More... | |
CLFullyConnectedLayer (const CLFullyConnectedLayer &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CLFullyConnectedLayer (CLFullyConnectedLayer &&)=default | |
Default move constructor. More... | |
CLFullyConnectedLayer & | operator= (const CLFullyConnectedLayer &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CLFullyConnectedLayer & | operator= (CLFullyConnectedLayer &&)=default |
Default move assignment operator. More... | |
void | configure (const CLCompileContext &compile_context, const ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, FullyConnectedLayerInfo fc_info=FullyConnectedLayerInfo()) |
Set the input and output tensors. More... | |
void | configure (const ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, FullyConnectedLayerInfo fc_info=FullyConnectedLayerInfo()) |
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... | |
Public Member Functions inherited from IFunction | |
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()) |
Static function to check if given info will lead to a valid configuration of CLFullyConnectedLayer. More... | |
Basic function to compute a Fully Connected layer on OpenCL.
This function calls the following OpenCL kernels:
are_weights_reshaped
is set to false and transpose_weights is set to true ) (called once)Definition at line 43 of file CLFullyConnectedLayer.h.
CLFullyConnectedLayer | ( | std::shared_ptr< IMemoryManager > | memory_manager = nullptr , |
IWeightsManager * | weights_manager = nullptr |
||
) |
Constructor.
Definition at line 53 of file CLFullyConnectedLayer.cpp.
|
default |
Default destructor.
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Default move constructor.
void configure | ( | const CLCompileContext & | compile_context, |
const ICLTensor * | input, | ||
const ICLTensor * | weights, | ||
const ICLTensor * | biases, | ||
ICLTensor * | output, | ||
FullyConnectedLayerInfo | fc_info = FullyConnectedLayerInfo() |
||
) |
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] | compile_context | The compile context to be used. |
[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 input . |
[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 |
Definition at line 72 of file CLFullyConnectedLayer.cpp.
References arm_compute::ACL_DST, arm_compute::ACL_SRC_0, arm_compute::ACL_SRC_1, arm_compute::ACL_SRC_2, ITensorInfo::are_values_constant(), FullyConnectedLayerInfo::are_weights_reshaped, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ITensor::info(), arm_compute::test::validation::input, FullyConnectedLayerInfo::retain_internal_weights, FullyConnectedLayerInfo::transpose_weights, and CLFullyConnectedLayer::validate().
Referenced by CLRNNLayer::configure(), CLFullyConnectedLayer::configure(), and CLLSTMLayer::configure().
void configure | ( | const ICLTensor * | input, |
const ICLTensor * | weights, | ||
const ICLTensor * | biases, | ||
ICLTensor * | output, | ||
FullyConnectedLayerInfo | fc_info = FullyConnectedLayerInfo() |
||
) |
Set the input and output tensors.
Similar to CLFullyConnectedLayer
Definition at line 63 of file CLFullyConnectedLayer.cpp.
References CLFullyConnectedLayer::configure(), CLKernelLibrary::get(), and arm_compute::test::validation::input.
|
default |
Default move assignment operator.
|
delete |
Prevent instances of this class from being copied (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 133 of file CLFullyConnectedLayer.cpp.
References ITensor::is_used().
Referenced by CLRNNLayer::prepare(), and CLFullyConnectedLayer::run().
|
overridevirtual |
Run the kernels contained in the function.
For CPU kernels:
For OpenCL kernels:
Implements IFunction.
Definition at line 122 of file CLFullyConnectedLayer.cpp.
References CLFullyConnectedLayer::prepare().
Referenced by CLRNNLayer::run(), and CLLSTMLayer::run().
|
static |
Static function to check if given info will lead to a valid configuration of CLFullyConnectedLayer.
Similar to CLFullyConnectedLayer
Definition at line 113 of file CLFullyConnectedLayer.cpp.
References arm_compute::test::validation::input, and ClFullyConnected::validate().
Referenced by CLFullyConnectedLayer::configure(), CLRNNLayer::validate(), and CLLSTMLayer::validate().