Compute Library
 21.02
NEConvertFullyConnectedWeights Class Reference

Basic function to run NEConvertFullyConnectedWeightsKernel. More...

#include <NEConvertFullyConnectedWeights.h>

Collaboration diagram for NEConvertFullyConnectedWeights:
[legend]

Public Member Functions

 NEConvertFullyConnectedWeights ()
 Default constructor. More...
 
 NEConvertFullyConnectedWeights (const NEConvertFullyConnectedWeights &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEConvertFullyConnectedWeightsoperator= (const NEConvertFullyConnectedWeights &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEConvertFullyConnectedWeights (NEConvertFullyConnectedWeights &&)=delete
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
NEConvertFullyConnectedWeightsoperator= (NEConvertFullyConnectedWeights &&)=delete
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
 ~NEConvertFullyConnectedWeights ()
 Default destructor. More...
 
void configure (const ITensor *input, ITensor *output, const TensorShape &original_input_shape, DataLayout data_layout)
 Initialize the function. 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...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *output, const TensorShape &original_input_shape, DataLayout data_layout)
 Static function to check if given info will lead to a valid configuration of NEConvertFullyConnectedWeights. More...
 

Detailed Description

Basic function to run NEConvertFullyConnectedWeightsKernel.

Definition at line 40 of file NEConvertFullyConnectedWeights.h.

Constructor & Destructor Documentation

◆ NEConvertFullyConnectedWeights() [1/3]

Default constructor.

Definition at line 31 of file NEConvertFullyConnectedWeights.cpp.

32  : _kernel()
33 {
34 }

◆ NEConvertFullyConnectedWeights() [2/3]

Prevent instances of this class from being copied (As this class contains pointers)

◆ NEConvertFullyConnectedWeights() [3/3]

Prevent instances of this class from being moved (As this class contains non movable objects)

◆ ~NEConvertFullyConnectedWeights()

Default destructor.

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
ITensor output,
const TensorShape original_input_shape,
DataLayout  data_layout 
)

Initialize the function.

Parameters
[in]inputSource weights tensor to convert. Must be 2 dimensional. Data types supported: All.
[out]outputThe converted weights tensor. Shape and Data Type: Same as input.
[in]original_input_shapeShape of the original input tensor (the one entering fully connected layer).
[in]data_layoutThe data layout the weights have been trained in.

Definition at line 36 of file NEConvertFullyConnectedWeights.cpp.

Referenced by NEFullyConnectedLayer::configure().

38 {
39  _kernel = std::make_unique<NEConvertFullyConnectedWeightsKernel>();
40  _kernel->configure(input, output, original_input_shape, data_layout);
41 }
const DataLayout data_layout
Definition: Im2Col.cpp:151

◆ operator=() [1/2]

Prevent instances of this class from being copied (As this class contains pointers)

◆ operator=() [2/2]

Prevent instances of this class from being moved (As this class contains non movable objects)

◆ run()

void run ( )
overridevirtual

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 49 of file NEConvertFullyConnectedWeights.cpp.

References Window::DimZ, Scheduler::get(), and IScheduler::schedule().

Referenced by NEFullyConnectedLayer::prepare().

50 {
51  NEScheduler::get().schedule(_kernel.get(), Window::DimZ);
52 }
virtual void schedule(ICPPKernel *kernel, const Hints &hints)=0
Runs the kernel in the same thread as the caller synchronously.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
Definition: Window.h:47
static IScheduler & get()
Access the scheduler singleton.
Definition: Scheduler.cpp:94

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
const TensorShape original_input_shape,
DataLayout  data_layout 
)
static

Static function to check if given info will lead to a valid configuration of NEConvertFullyConnectedWeights.

Parameters
[in]inputSource weights tensor info to convert. Must be 2 dimensional. Data types supported: All.
[in]outputThe converted weights tensor info. Shape and Data Type: Same as input.
[in]original_input_shapeShape of the original input tensor (the one entering fully connected layer).
[in]data_layoutThe data layout the weights have been trained in.
Returns
A Status

Definition at line 43 of file NEConvertFullyConnectedWeights.cpp.

References NEConvertFullyConnectedWeightsKernel::validate().

Referenced by NEFullyConnectedLayer::validate().

45 {
46  return NEConvertFullyConnectedWeightsKernel::validate(input, output, original_input_shape, data_layout);
47 }
const DataLayout data_layout
Definition: Im2Col.cpp:151
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const TensorShape &original_input_shape, DataLayout data_layout)
Static function to check if given info will lead to a valid configuration of NEConvertFullyConnectedW...

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