Compute Library
GCDropoutLayer Class Reference

Basic function to do dropout op. More...

#include <GCDropoutLayer.h>

Collaboration diagram for GCDropoutLayer:

Public Member Functions

 GCDropoutLayer ()
 Constructor. More...
void configure (const IGCTensor *input, IGCTensor *mask, IGCTensor *output, float ratio, bool forward)
 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...

Detailed Description

Basic function to do dropout op.

This function calls the following kernels:

  1. GCDropoutLayerKernel
This function is deprecated and is intended to be removed in 21.05 release

Definition at line 41 of file GCDropoutLayer.h.

Constructor & Destructor Documentation

◆ GCDropoutLayer()


Definition at line 33 of file GCDropoutLayer.cpp.

34  : _dropout_kernel()
35 {
36 }

Member Function Documentation

◆ configure()

void configure ( const IGCTensor input,
IGCTensor mask,
IGCTensor output,
float  ratio,
bool  forward 

Set the input and output tensors.

[in]inputSource tensor. Data type supported: F16/F32.
[out]maskDestination tensor. Data type supported: Same as input.
[out]outputDestination tensor. Data type supported: Same as input.
[in]ratioDropout ratio
[in]forwardForward or backward propagation

Definition at line 38 of file GCDropoutLayer.cpp.

References ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES, GCDropoutLayerKernel::configure(), arm_compute::F16, and arm_compute::F32.

39 {
43  // Configure kernel
44  _dropout_kernel.configure(input, mask, output, ratio, forward);
45 }
1 channel, 1 F32 per channel
1 channel, 1 F16 per channel
Definition: Validate.h:543
Definition: Validate.h:790
void configure(const IGCTensor *input, IGCTensor *mask, IGCTensor *output, float ratio, bool forward)
Set the input and output of the kernel.

◆ run()

void run ( )

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.
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.
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 47 of file GCDropoutLayer.cpp.

References GCScheduler::dispatch(), and GCScheduler::get().

48 {
49  GCScheduler::get().dispatch(_dropout_kernel);
50 }
void dispatch(IGCKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.
Definition: GCScheduler.cpp:77
static GCScheduler & get()
Access the scheduler singleton.
Definition: GCScheduler.cpp:70

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