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();
51 PixelValue type_min{};
52 PixelValue type_max{};
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;
110 _gemm_asm_func->configure(
input, &_permuted_weights, biases, output, asm_info);
113 if(
info.act_info.enabled() && !_gemm_asm_func->is_activation_supported(
info.act_info))
116 _run_activation =
true;
134 if(biases !=
nullptr)
160 _gemm_asm_func->run();
163 _activation_func.
run();
171 _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(...)
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
~NEGEMMConv2d()
Destructor.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
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 CPU 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
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.
Class for specifying the size of an image or rectangle.
#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]
#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 function.
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.