24.02
|
Go to the documentation of this file.
37 struct NEGEMMConv2d::Impl
39 const ITensor *weights{
nullptr};
40 std::unique_ptr<OperatorType> op{
nullptr};
41 ITensorPack run_pack{};
42 ITensorPack prep_pack{};
43 WorkspaceData<Tensor> workspace{};
44 MemoryGroup memory_group{};
45 bool is_prepared{
false};
61 _impl->weights = weights;
62 _impl->is_prepared =
false;
63 _impl->op = std::make_unique<OperatorType>();
65 _impl->op->configure(
input->info(), weights->
info(), biases !=
nullptr ? biases->
info() :
nullptr, output->
info(),
68 _impl->aux_mem_req = _impl->op->workspace();
72 manage_workspace<Tensor>(_impl->op->workspace(), _impl->memory_group, _impl->run_pack, _impl->prep_pack);
89 _impl->op->run(_impl->run_pack);
94 if (!_impl->is_prepared)
96 _impl->op->prepare(_impl->prep_pack);
99 std::find_if(_impl->aux_mem_req.begin(), _impl->aux_mem_req.end(),
100 [](
const MemoryInfo &m) ->
bool { return m.lifetime == MemoryLifetime::Persistent; });
102 if (has_reshape !=
std::end(_impl->aux_mem_req))
104 _impl->weights->mark_as_unused();
108 _impl->run_pack.add_const_tensor(
ACL_SRC_1, _impl->weights);
112 release_temporaries<Tensor>(_impl->aux_mem_req, _impl->workspace);
113 _impl->is_prepared =
true;
std::vector< MemoryInfo > MemoryRequirements
void configure(ITensor *input, const ITensor *weights, const ITensor *biases, ITensor *output, const Conv2dInfo &info)
Set the input and output tensors.
Interface for CPU tensor.
void prepare() override
Prepare the function for executing.
Descriptor used by the 2d Convolution function.
#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.
void run() override
Run the kernels contained in the function.
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.
opencl::ClGemm OperatorType
NEGEMMConv2d(const std::shared_ptr< IMemoryManager > &memory_manager=nullptr)
Constructor.
Memory group resources scope handling class.
Copyright (c) 2017-2024 Arm Limited.
void end(TokenStream &in, bool &valid)
Store the tensor's metadata.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
static Status validate(const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *output, float alpha, float beta, const GEMMInfo &gemm_info)
Static function to check if given info will lead to a valid configuration.
~NEGEMMConv2d()
Destructor.