37 GEMMLowpOutputStageInfo calculate_output_stage_metadata(
const ITensorInfo *
input,
const ITensorInfo *weights,
const ITensorInfo *output,
const ActivationLayerInfo &act)
41 const QuantizationInfo iqinfo = input->quantization_info();
42 const QuantizationInfo wqinfo = weights->quantization_info();
43 const QuantizationInfo oqinfo = (output->total_size() == 0) ? iqinfo : output->quantization_info();
44 const UniformQuantizationInfo uoqinfo = oqinfo.uniform();
54 int32_t min_activation =
type_min.get<int32_t>();
55 int32_t max_activation =
type_max.get<int32_t>();
56 if(supported_acts.count(act.activation()) != 0)
60 GEMMLowpOutputStageInfo os_info;
62 os_info.gemmlowp_offset = uoqinfo.offset;
63 os_info.gemmlowp_min_bound = min_activation;
64 os_info.gemmlowp_max_bound = max_activation;
69 AsmGemmInfo init_assembly_metadata(
const Conv2dInfo &
info,
bool is_indirect)
73 asm_info.ps_info = info.conv_info;
74 asm_info.activation_info = info.act_info;
75 asm_info.depth_output_gemm3d =
true;
76 asm_info.reinterpret_input_as_3d =
true;
77 asm_info.padding_top = info.conv_info.pad_top();
78 asm_info.padding_left = info.conv_info.pad_left();
79 asm_info.padding_value = 0.f;
80 asm_info.negated_offsets =
false;
86 : _gemm_asm_func(
std::make_unique<
NEGEMMAssemblyDispatch>(memory_manager)), _activation_func(), _weights_permute_func(), _original_weights(nullptr), _permuted_weights(), _is_prepared(false),
87 _run_activation(false)
98 biases !=
nullptr ? biases->
info() :
nullptr,
101 _original_weights = weights;
105 AsmGemmInfo asm_info = init_assembly_metadata(info,
false);
110 _gemm_asm_func->configure(input, &_permuted_weights, biases, output, asm_info);
116 _run_activation =
true;
133 if(biases !=
nullptr)
151 AsmGemmInfo asm_info = init_assembly_metadata(info,
false);
159 _gemm_asm_func->run();
162 _activation_func.
run();
170 _weights_permute_func.
run();
bool is_data_type_quantized(DataType dt)
Check if a given data type is of quantized type.
virtual size_t num_dimensions() const =0
The number of dimensions of the tensor (rank)
Quantize using a fixed point multiplication.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(...)
bool enabled() const
Check if initialised.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
ActivationLayerInfo act_info
~NEGEMMConv2d()
Destructor.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
1 channel, 1 F32 per channel
Store the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Interface for Neon tensor.
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
TensorAllocator * allocator()
Return a pointer to the tensor's allocator.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
void mark_as_unused() const
Marks a tensor as unused.
1 channel, 1 S32 per channel
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const Conv2dInfo &info)
Static function to check if given info will lead to a valid configuration of NEGEMMConv2d.
16-bit brain floating-point number
void run() override
Run the kernels contained in the function.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
std::pair< int32_t, int32_t > get_quantized_activation_min_max(ActivationLayerInfo act_info, DataType data_type, UniformQuantizationInfo oq_info)
Returns a pair of minimum and maximum values for a quantized activation.
Status calculate_quantized_multipliers(const QuantizationInfo &iq_info, const QuantizationInfo &wq_info, const QuantizationInfo &oq_info, GEMMLowpOutputStageInfo &stage_info)
Calculate quantized representation of per-channel multipliers.
quantized, asymmetric fixed-point 8-bit number unsigned
void allocate() override
Allocate size specified by TensorInfo of CPU memory.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
static Status validate(const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *d, const AsmGemmInfo &info)
Indicates whether or not this function can be used to process the given parameters.
Descriptor used by the Convolution function.
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.
GEMMLowpOutputStageInfo output_stage
Strides of an item in bytes.
quantized, symmetric per channel fixed-point 8-bit number
__constant DATA_TYPE16 type_min
Lower and Upper Bounded Rectifier ( )
void run() override
Run the kernels contained in the function.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Upper Bounded Rectifier ( )
NEGEMMConv2d(const std::shared_ptr< IMemoryManager > &memory_manager=nullptr)
Constructor.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
Num samples, height, width, channels.
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
void configure(ITensor *input, ITensor *output, ActivationLayerInfo activation_info)
[NEActivationLayer snippet]
__constant DATA_TYPE16 type_max
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
quantized, asymmetric fixed-point 8-bit number signed
void configure(const ITensor *input, ITensor *output, const PermutationVector &perm)
Configure the permute Neon kernel.
DataType
Available data types.
std::tuple< PixelValue, PixelValue > get_min_max(DataType dt)
Compute the mininum and maximum values a data type can take.
void prepare() override
Prepare the function for executing.
void configure(ITensor *input, const ITensor *weights, const ITensor *biases, ITensor *output, const Conv2dInfo &info)
Set the input and output tensors.
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.