21.02
|
Basic function to compute a SoftmaxLayer. More...
#include <GCSoftmaxLayer.h>
Public Member Functions | |
GCSoftmaxLayer (std::shared_ptr< IMemoryManager > memory_manager=nullptr) | |
Constructor. More... | |
void | configure (const IGCTensor *input, IGCTensor *output, float beta=1.0f, int32_t axis=0) |
Set the input and output tensors. More... | |
void | run () override |
Run the kernels contained in the function. More... | |
Public Member Functions inherited from IFunction | |
virtual | ~IFunction ()=default |
Destructor. More... | |
virtual void | prepare () |
Prepare the function for executing. More... | |
Basic function to compute a SoftmaxLayer.
Softmax is calculated by :
\[ out = exp(x - max(x)) / sum(exp(x - max(x))) \]
This function runs the following kernels:
Definition at line 49 of file GCSoftmaxLayer.h.
GCSoftmaxLayer | ( | std::shared_ptr< IMemoryManager > | memory_manager = nullptr | ) |
Constructor.
Definition at line 32 of file GCSoftmaxLayer.cpp.
Set the input and output tensors.
[in] | input | Source tensor. Data types supported: F16/F32 |
[out] | output | Destination tensor. Data types supported: same as input |
[in] | beta | (Optional) A scaling factor for the exponent. Only beta = 1 is supported |
[in] | axis | (Optional) The dimension in which to apply the function. E.g. for input of shape 4x5x6 and axis=1, softmax will be applied to 4x6=24 vectors of size 5. Defaults to 0 |
axis
must be always 0 for GLES Definition at line 37 of file GCSoftmaxLayer.cpp.
References ITensorAllocator::allocate(), GCTensor::allocator(), ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_ERROR_ON_MSG, ARM_COMPUTE_UNUSED, GCLogits1DMaxKernel::configure(), GCLogits1DShiftExpSumKernel::configure(), GCLogits1DNormKernel::configure(), ITensorInfo::data_type(), arm_compute::F16, arm_compute::F32, ITensor::info(), ITensorAllocator::init(), MemoryGroup::manage(), ITensorInfo::num_channels(), TensorShape::set(), arm_compute::test::validation::shape, and ITensorInfo::tensor_shape().
|
overridevirtual |
Run the kernels contained in the function.
For Neon kernels:
For OpenCL kernels:
Implements IFunction.
Definition at line 70 of file GCSoftmaxLayer.cpp.
References GCScheduler::dispatch(), GCScheduler::get(), and GCScheduler::memory_barrier().