24.02.1
|
Go to the documentation of this file.
42 : _memory_group(std::move(memory_manager)),
43 _not_reshaped_output(),
44 _arg_min_max_kernel(),
60 "Invalid reduction operation");
62 "Reduction axis greater than max number of dimensions");
67 const auto input_num_channles =
input->num_channels();
68 const auto input_qinfo =
input->quantization_info();
73 const TensorInfo expected_output_shape = output->
clone()->set_tensor_shape(
78 auto shape_before_reshape =
input->tensor_shape();
79 shape_before_reshape.set(axis, 1);
85 initialize_tensorinfo(not_reshaped_output, shape_before_reshape, output_data_type, input_num_channles, input_qinfo);
106 _reduction_axis = axis;
115 .set_data_type(output_data_type)
117 .set_is_resizable(
true));
120 not_reshaped_output_shape.set(axis, 1);
123 ->set_tensor_shape(not_reshaped_output_shape)
124 .set_data_type(output_data_type)
126 .set_is_resizable(
true));
128 _arg_min_max_kernel = std::make_unique<CLArgMinMaxLayerKernel>();
129 _arg_min_max_kernel->configure(compile_context,
input, &_not_reshaped_output, axis, op);
131 _memory_group.
manage(&_not_reshaped_output);
133 _reshape.
configure(compile_context, &_not_reshaped_output, output);
void configure(const ICLTensor *input, int axis, ICLTensor *output, const ReductionOperation &op)
Set the input and output tensors.
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
Quantization information.
virtual ITensorInfo & set_num_channels(int num_channels)=0
Set the number of channels to the specified value.
void enqueue(ICLKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.
CLArgMinMaxLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Default Constructor.
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
~CLArgMinMaxLayer()
Default destructor.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
virtual ITensorInfo & set_tensor_shape(const TensorShape &shape)=0
Set the shape of an already initialized tensor.
Interface for OpenCL tensor.
ITensorInfo & set_data_type(DataType data_type) override
Set the data type to the specified value.
ReductionOperation
Available reduction operations.
void run() override
Run the kernels contained in the function.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
Auto initialize the tensor info (shape, number of channels and data type) if the current assignment i...
#define ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(tensor)
@ QASYMM8_SIGNED
quantized, asymmetric fixed-point 8-bit number signed
virtual DataType data_type() const =0
Data type used for each element of the tensor.
TensorShape compute_reduced_shape(const TensorShape &input, unsigned int axis, bool keep_dims=true)
Calculate the reduced shape of a tensor given an axis.
@ ARG_IDX_MAX
Index of the max value.
static Status validate(const ITensorInfo *input, const ITensorInfo *output, unsigned int axis, ReductionOperation op)
Static function to check if given info will lead to a valid configuration of CLArgMinMaxLayerKernel.
void allocate() override
Allocate size specified by TensorInfo of OpenCL memory.
CLTensorAllocator * allocator()
Return a pointer to the tensor's allocator.
static CLScheduler & get()
Access the scheduler singleton.
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
Store the tensor's metadata.
@ ARG_IDX_MIN
Index of the min value.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Memory group resources scope handling class.
Copyright (c) 2017-2024 Arm Limited.
@ F16
16-bit floating-point number
@ S32
signed 32-bit number
void run() override
Run the kernels contained in the function.
TensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
static Status validate(const ITensorInfo *input, int axis, const ITensorInfo *output, const ReductionOperation &op)
Static function to check if given info will lead to a valid configuration of CLArgMinMaxLayer.
Store the tensor's metadata.
@ F32
32-bit floating-point number
void configure(const ICLTensor *input, ICLTensor *output)
Initialise the kernel's inputs and outputs.
@ UNKNOWN
Unknown data type.
#define ARM_COMPUTE_LOG_PARAMS(...)
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
DataType
Available data types.
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
const QuantizationInfo qinfo
virtual ITensorInfo & set_quantization_info(const QuantizationInfo &quantization_info)=0
Set the quantization settings (scale and offset) of the tensor.
static Status validate(const ITensorInfo *input, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of CLReshapeLayer.