|
| GCActivationLayerKernel (GCCoreRuntimeContext *ctx=nullptr) |
| Default constructor. More...
|
|
| GCActivationLayerKernel (const GCActivationLayerKernel &)=delete |
| Prevent instances of this class from being copied (As this class contains pointers) More...
|
|
GCActivationLayerKernel & | operator= (const GCActivationLayerKernel &)=delete |
| Prevent instances of this class from being copied (As this class contains pointers) More...
|
|
| GCActivationLayerKernel (GCActivationLayerKernel &&)=default |
| Allow instances of this class to be moved. More...
|
|
GCActivationLayerKernel & | operator= (GCActivationLayerKernel &&)=default |
| Allow instances of this class to be moved. More...
|
|
| ~GCActivationLayerKernel ()=default |
| Default destructor. More...
|
|
void | configure (IGCTensor *input, IGCTensor *output, ActivationLayerInfo act_info) |
| Set the input and output tensor. More...
|
|
void | run (const Window &window) override |
| Enqueue the OpenGL ES shader to process the given window. More...
|
|
| IGCKernel () |
| Constructor. More...
|
|
GCKernel & | kernel () |
| Returns a reference to the GLES kernel of this object. More...
|
|
void | add_1D_tensor_argument (unsigned int &idx, const IGCTensor *tensor, const unsigned int binding_point, const Window &window) |
| Add the passed 1D tensor's parameters to the object's kernel's arguments starting from the index idx. More...
|
|
void | add_2D_tensor_argument (unsigned int &idx, const IGCTensor *tensor, const unsigned int binding_point, const Window &window) |
| Add the passed 2D tensor's parameters to the object's kernel's arguments starting from the index idx. More...
|
|
void | add_3D_tensor_argument (unsigned int &idx, const IGCTensor *tensor, const unsigned int binding_point, const Window &window) |
| Add the passed 3D tensor's parameters to the object's kernel's arguments starting from the index idx. More...
|
|
unsigned int | num_arguments_per_1D_tensor () const |
| Returns the number of arguments enqueued per 1D tensor object. More...
|
|
unsigned int | num_arguments_per_2D_tensor () const |
| Returns the number of arguments enqueued per 2D tensor object. More...
|
|
unsigned int | num_arguments_per_3D_tensor () const |
| Returns the number of arguments enqueued per 3D tensor object. More...
|
|
void | set_lws_hint (gles::NDRange &lws_hint) |
| Set the Local-Workgroup-Size hint. More...
|
|
void | set_target (GPUTarget target) |
| Set the targeted GPU architecture. More...
|
|
GPUTarget | get_target () const |
| Get the targeted GPU architecture. More...
|
|
| IKernel () |
| Constructor. More...
|
|
virtual | ~IKernel ()=default |
| Destructor. More...
|
|
virtual bool | is_parallelisable () const |
| Indicates whether or not the kernel is parallelisable. More...
|
|
virtual BorderSize | border_size () const |
| The size of the border for that kernel. More...
|
|
const Window & | window () const |
| The maximum window the kernel can be executed on. More...
|
|
Interface for the activation layer kernel.
Definition at line 36 of file GCActivationLayerKernel.h.
Set the input and output tensor.
- Note
- If the output tensor is a nullptr, the activation function will be performed in-place
- Parameters
-
[in,out] | input | Source tensor. In case of output tensor = nullptr, this tensor will store the result of the activation function. Data types supported: F16/F32. |
[out] | output | Destination tensor. Data type should match the input data type. |
[in] | act_info | Activation layer information. |
Definition at line 49 of file GCActivationLayerKernel.cpp.
References ActivationLayerInfo::a(), ActivationLayerInfo::activation(), ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES, ARM_COMPUTE_ERROR_ON_MISMATCHING_SHAPES, arm_compute::auto_init_if_empty(), ActivationLayerInfo::b(), arm_compute::calculate_max_window(), arm_compute::create_opengl_kernel(), ITensorInfo::data_type(), ITensorInfo::element_size(), arm_compute::F16, arm_compute::F32, arm_compute::float_to_string_with_full_precision(), ITensor::info(), arm_compute::test::validation::input, num_elems_processed_per_iteration, ITensorInfo::set_valid_region(), arm_compute::string_from_activation_func(), ITensorInfo::tensor_shape(), arm_compute::support::cpp11::to_string(), and arm_compute::update_window_and_padding().
71 std::set<std::string> build_opts;
74 build_opts.emplace((
"#define " + dt_name));
103 IGCKernel::configure(win);
GCKernel create_opengl_kernel(GCCoreRuntimeContext *ctx, const std::string &kernel_name, const std::set< std::string > &build_opts)
Creates an GLES kernel.
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
float a() const
Get the alpha value.
std::string to_string(T &&value)
Convert integer and float values to string.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
1 channel, 1 F32 per channel
const std::string & string_from_activation_func(ActivationLayerInfo::ActivationFunction act)
Translates a given activation function to a string.
virtual void set_valid_region(const ValidRegion &valid_region)=0
Set the valid region of the tensor.
1 channel, 1 F16 per channel
bool update_window_and_padding(Window &win, Ts &&... patterns)
Update window and padding size for each of the access patterns.
std::string float_to_string_with_full_precision(float val)
Create a string with the float in full precision.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
#define ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(...)
Class to describe a number of elements in each dimension.
Implementation of a row access pattern.
#define ARM_COMPUTE_ERROR_ON_MISMATCHING_SHAPES(...)
bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
Auto initialize the tensor info (shape, number of channels and data type) if the current assignment i...
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
virtual size_t element_size() const =0
Element size in bytes calculated as data_size() * num_channels()
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
unsigned int num_elems_processed_per_iteration
ActivationFunction activation() const
Get the type of activation function.
float b() const
Get the beta value.
Container for valid region of a window.
Describe a multidimensional execution window.
void run |
( |
const Window & |
window | ) |
|
|
overridevirtual |
Enqueue the OpenGL ES shader to process the given window.
- Parameters
-
[in] | window | Region on which to execute the kernel. (Must be a valid region of the window returned by window()). |
Implements IGCKernel.
Definition at line 106 of file GCActivationLayerKernel.cpp.
References IGCKernel::add_3D_tensor_argument(), ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, Window::collapse_if_possible(), Window::DimX, Window::DimZ, arm_compute::enqueue(), Window::first_slice_window_3D(), ITensor::info(), ITensorInfo::padding(), IGCTensor::set_needs_shifting(), Window::shift(), arm_compute::test::validation::reference::slice(), Window::slide_window_slice_3D(), and IKernel::window().
121 if(_input == _output)
128 unsigned int idx = 0;
129 unsigned int binding = 1;
132 _kernel.update_shader_params();
const Window & window() const
The maximum window the kernel can be executed on.
void add_3D_tensor_argument(unsigned int &idx, const IGCTensor *tensor, const unsigned int binding_point, const Window &window)
Add the passed 3D tensor's parameters to the object's kernel's arguments starting from the index idx...
void enqueue(IGCKernel &kernel, const Window &window, const gles::NDRange &lws=gles::NDRange(1U, 1U, 1U))
Add the kernel to the command queue with the given window.
void shift(size_t dimension, int shift_value)
Shift the values of a given dimension by the given shift_value.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
Window collapse_if_possible(const Window &full_window, size_t first, size_t last, bool *has_collapsed=nullptr) const
Collapse the dimensions between first and last if possible.
void set_needs_shifting(bool needs_shifting)
Set the flag indicating whether or not a tensor needs shifting.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
virtual PaddingSize padding() const =0
Padding of tensor.
bool slide_window_slice_3D(Window &slice) const
Slide the passed 3D window slice.
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
Window first_slice_window_3D() const
First 3D slice of the window.
Describe a multidimensional execution window.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
SimpleTensor< T > slice(const SimpleTensor< T > &src, Coordinates starts, Coordinates ends)