Compute Library
 19.08
GCDepthwiseConvolutionLayer3x3 Class Reference

Basic function to execute a depthwise convolution for kernel size 3x3xC. More...

#include <GCDepthwiseConvolutionLayer.h>

Collaboration diagram for GCDepthwiseConvolutionLayer3x3:
[legend]

Public Member Functions

 GCDepthwiseConvolutionLayer3x3 ()
 Default constructor. More...
 
void configure (IGCTensor *input, const IGCTensor *weights, const IGCTensor *biases, IGCTensor *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier=1, const ActivationLayerInfo &act_info=ActivationLayerInfo(), const Size2D &dilation=Size2D(1U, 1U))
 Initialize the function's source, destination, conv and border_size. More...
 
void run () override final
 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...
 

Detailed Description

Basic function to execute a depthwise convolution for kernel size 3x3xC.

This function calls the following OpenGLES kernels:

  1. GCDepthwiseConvolutionLayer3x3Kernel
  2. GCFillBorderKernel (if pad_x or pad_y > 0)

Definition at line 44 of file GCDepthwiseConvolutionLayer.h.

Constructor & Destructor Documentation

◆ GCDepthwiseConvolutionLayer3x3()

Default constructor.

Definition at line 33 of file GCDepthwiseConvolutionLayer.cpp.

34  : _kernel(nullptr), _border_handler(), _shift_handler(), _activationlayer_function(), _is_activationlayer_enabled(false)
35 {
36 }

Member Function Documentation

◆ configure()

void configure ( IGCTensor input,
const IGCTensor weights,
const IGCTensor biases,
IGCTensor output,
const PadStrideInfo conv_info,
unsigned int  depth_multiplier = 1,
const ActivationLayerInfo act_info = ActivationLayerInfo(),
const Size2D dilation = Size2D(1U, 1U) 
)

Initialize the function's source, destination, conv and border_size.

Parameters
[in,out]inputSource tensor. Data type supported: F16. (Written to only for border filling).
[in]weightsWeights tensor. A 3D tensor with shape [3, 3, IFM]. Data type supported: Same as input.
[in]biasesBiases tensor. A 1D tensor with shape [IFM]. Must be nullptr if not needed. Data type supported: Same as input.
[out]outputDestination tensor. Data type supported: same as input.
[in]conv_infoPadding and stride information to use for the convolution.
[in]depth_multiplier(Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
[in]act_info(Optional) Activation layer information in case of a fused activation.
[in]dilation(Optional) Dilation, in elements, across x and y. Defaults to (1, 1). Currently supports (1,1) only.

Definition at line 38 of file GCDepthwiseConvolutionLayer.cpp.

40 {
41  ARM_COMPUTE_ERROR_ON(dilation.x() != 1 || dilation.y() != 1);
43  auto k = arm_compute::support::cpp14::make_unique<GCDepthwiseConvolutionLayer3x3Kernel>();
44  k->configure(input, weights, biases, output, conv_info, depth_multiplier);
45  _kernel = std::move(k);
46 
47  // Configure border handler
48  _border_handler.configure(input, _kernel->border_size(), BorderMode::CONSTANT, PixelValue());
49 
50  _shift_handler.configure(input);
51 
52  //Configure Activation Layer
53  _is_activationlayer_enabled = act_info.enabled();
54 
55  if(_is_activationlayer_enabled)
56  {
57  _activationlayer_function.configure(output, nullptr, act_info);
58  }
59 }
Class describing the value of a pixel for any image format.
Definition: PixelValue.h:34
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:337
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:160
void configure(const IGCTensor *tensor, BorderSize border_size, BorderMode border_mode, const PixelValue &constant_border_value=PixelValue())
Initialise the kernel's input, output and border mode.
void configure(IGCTensor *input, IGCTensor *output, ActivationLayerInfo act_info)
Set the input and output tensor.
void configure(IGCTensor *input)
Set the input of the kernel.

References arm_compute::test::validation::act_info, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_UNUSED, GCActivationLayer::configure(), GCFillBorderKernel::configure(), GCTensorShiftKernel::configure(), arm_compute::CONSTANT, arm_compute::test::validation::conv_info, arm_compute::test::validation::dilation, and arm_compute::test::validation::weights.

◆ run()

void run ( )
finaloverridevirtual

Run the kernels contained in the function.

For NEON kernels:

  • Multi-threading is used for the kernels which are parallelisable.
  • By default std::thread::hardware_concurrency() threads are used.
Note
CPPScheduler::set_num_threads() can be used to manually set the number of threads

For OpenCL kernels:

  • All the kernels are enqueued on the queue associated with CLScheduler.
  • The queue is then flushed.
Note
The function will not block until the kernels are executed. It is the user's responsibility to wait.
Will call prepare() on first run if hasn't been done

Implements IFunction.

Definition at line 61 of file GCDepthwiseConvolutionLayer.cpp.

62 {
63  GCScheduler::get().dispatch(_shift_handler, false);
65  GCScheduler::get().dispatch(_border_handler, false);
67  GCScheduler::get().dispatch(*_kernel);
68 
69  // Run Activation Layer
70  if(_is_activationlayer_enabled)
71  {
72  _activationlayer_function.run();
73  }
74 }
void dispatch(IGCKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.
Definition: GCScheduler.cpp:69
void run() override final
Run the kernels contained in the function.
void memory_barrier()
Defines a barrier ordering memory transactions.
Definition: GCScheduler.cpp:78
static GCScheduler & get()
Access the scheduler singleton.
Definition: GCScheduler.cpp:62

References GCScheduler::dispatch(), GCScheduler::get(), GCScheduler::memory_barrier(), and IGCSimpleFunction::run().


The documentation for this class was generated from the following files: