39 : _weights_reshape_kernel()
58 const IGCTensor *biases_to_use = (append_biases) ? biases :
nullptr;
60 _weights_reshape_kernel.
configure(weights, biases_to_use, output);
69 : _memory_group(
std::move(memory_manager)), _reshape_weights(), _input_im2col_kernel(), _mm_gemm(), _output_col2im_kernel(), _fill_border(), _activationlayer_function(), _original_weights(nullptr),
70 _input_im2col_reshaped(), _input_interleaved_reshaped(), _weights_reshaped(), _weights_transposed(), _gemm_output(), _tmp_output(), _is_activationlayer_enabled(false), _is_prepared(false)
79 _mm_gemm.
configure(input, weights,
nullptr, output, 1.f, 0.0f,
GEMMInfo(
false,
false,
true ));
101 _is_prepared =
false;
102 _original_weights = weights;
104 if(biases !=
nullptr)
117 const bool append_bias = (biases !=
nullptr);
118 const unsigned bias_element = (append_bias) ? 1 : 0;
119 const IGCTensor *biases_to_use = (append_bias) ? biases :
nullptr;
122 unsigned int stride_x = 0;
123 unsigned int stride_y = 0;
124 std::tie(stride_x, stride_y) = conv_info.
stride();
127 unsigned int conv_w = 0;
128 unsigned int conv_h = 0;
130 const unsigned int kernel_width = weights->
info()->
dimension(0);
131 const unsigned int kernel_height = weights->
info()->
dimension(1);
135 unsigned int mat_weights_cols = weights->
info()->
dimension(3);
140 _reshape_weights.
configure(weights, biases_to_use, &_weights_reshaped);
142 weights = &_weights_reshaped;
145 const unsigned int mat_input_cols = mat_weights_rows;
146 const unsigned int mat_input_rows = conv_w * conv_h;
148 shape_im2col.
set(0, mat_input_cols);
149 shape_im2col.
set(1, mat_input_rows);
150 shape_im2col.
set(2, 1);
153 TensorInfo im2col_reshaped_info(shape_im2col, 1, dt);
154 _input_im2col_reshaped.
allocator()->
init(im2col_reshaped_info);
155 _memory_group.
manage(&_input_im2col_reshaped);
159 shape_gemm.
set(0, mat_weights_cols);
160 shape_gemm.
set(1, mat_input_rows);
164 TensorInfo info_gemm(shape_gemm, 1, gemm_data_type);
166 _memory_group.
manage(&_gemm_output);
170 BorderSize border_size =
BorderSize(conv_info.pad_top(), conv_info.pad_right(), conv_info.pad_bottom(), conv_info.pad_left());
175 _input_im2col_kernel.
configure(input, &_input_im2col_reshaped,
Size2D(kernel_width, kernel_height), conv_info, append_bias, dilation);
178 configure_mm(&_input_im2col_reshaped, weights, &_gemm_output);
183 _output_col2im_kernel.
configure(&_gemm_output, output, std::make_pair(conv_w, conv_h));
189 _is_activationlayer_enabled = act_info.
enabled();
191 if(_is_activationlayer_enabled)
193 _activationlayer_function.
configure(output,
nullptr, act_info);
219 if(_is_activationlayer_enabled)
221 _activationlayer_function.
run();
233 _reshape_weights.
run();
void configure(const IGCTensor *input, IGCTensor *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, const Size2D &dilation=Size2D(1U, 1U))
Set the input and output of the kernel.
GCConvolutionLayerReshapeWeights()
Constructor.
virtual size_t num_dimensions() const =0
The number of dimensions of the tensor (rank)
Class describing the value of a pixel for any image format.
bool enabled() const
Check if initialised.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
void prepare() override
Prepare the function for executing.
void dispatch(IGCKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.
Container for 2D border size.
void run() override
Run the kernels contained in the function.
void run() override final
Run the kernels contained in the function.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
bool is_used() const
Flags if the tensor is used or not.
bool are_reshaped() const
Flag which specifies if the weights tensor has been reshaped.
1 channel, 1 F32 per channel
void memory_barrier()
Defines a barrier ordering memory transactions.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
void configure(const IGCTensor *input, const IGCTensor *biases, IGCTensor *output)
Set the input and output of the kernel.
Store the tensor's metadata.
Interface for GLES Compute tensor.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Activation Layer Information class.
void init(const TensorInfo &input, size_t alignment=0)
Initialize a tensor based on the passed TensorInfo.
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
std::pair< unsigned int, unsigned int > scaled_dimensions(int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info, const Size2D &dilation=Size2D(1U, 1U))
Returns expected width and height of output scaled tensor depending on dimensions rounding mode...
void set_target(GPUTarget target)
Set the targeted GPU architecture.
Convolution Layer Weights Information class.
void mark_as_unused() const
Marks a tensor as unused.
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
static GCScheduler & get()
Access the scheduler singleton.
void configure(const IGCTensor *weights, const IGCTensor *biases, IGCTensor *output)
Set the input and output tensors.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
#define ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(...)
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
const unsigned int num_groups
void run() override
Run the kernels contained in the function.
std::pair< unsigned int, unsigned int > stride() const
Get the stride.
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.
static Status validate(const ITensorInfo *a, const ITensorInfo *b, const IGCTensor *c, const ITensorInfo *output, const float alpha, const float beta, const GEMMInfo &gemm_info=GEMMInfo())
Static function to check if given info will lead to a valid configuration of GCGEMM.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
Padding and stride information class.
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
virtual void allocate()=0
Interface to be implemented by the child class to allocate the tensor.
void run() override
Run the kernels contained in the function.
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
void configure(IGCTensor *input, IGCTensor *output, ActivationLayerInfo act_info)
Set the input and output tensor.
GCConvolutionLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Default constructor.
Memory group resources scope handling class.
TensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
void configure(const IGCTensor *input, const IGCTensor *weights, const IGCTensor *biases, IGCTensor *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info=WeightsInfo(), const Size2D &dilation=Size2D(1U, 1U), const ActivationLayerInfo &act_info=ActivationLayerInfo(), unsigned int num_groups=1)
Set the input and output tensors.
Class for specifying the size of an image or rectangle.
Interface to enqueue GLES kernels and get/set the GLES CommandQueue.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Store the tensor's metadata.
void configure(const IGCTensor *a, const IGCTensor *b, const IGCTensor *c, IGCTensor *output, float alpha, float beta, const GEMMInfo &gemm_info=GEMMInfo())
Initialise the kernel's inputs and output.
const TensorShape & tensor_shape() const override
Size for each dimension of the tensor.
DataType
Available data types.
ITensorAllocator * allocator()
Return a pointer to the tensor's allocator.
virtual bool extend_padding(const PaddingSize &padding)=0
Update the offset to the first element, the strides and the total size.
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
void configure(const IGCTensor *input, IGCTensor *output, std::pair< unsigned int, unsigned int > convolved_dims)
Set the input and output of the kernel.