17#include "../KernelGenerator.h"
18#include "../Validator.h"
25void Validator::visit(
const ir::operation::Gather &) {
_supported =
true; }
27void KernelGenerator::visit(
const ir::operation::Gather &node)
29 const auto ofm_index{node.getOutputs().at(0)};
34 const auto ifm_rank = _ctx.
at(ifm_index).shape().rank();
35 const auto axis_raw = node.param().axis;
36 const auto axis_value = (axis_raw < 0 ? (ifm_rank + axis_raw) : axis_raw);
39 auto ofm_tensor = _tensor_reg->getAclTensor(ofm_index);
40 auto ifm_tensor = _tensor_reg->getAclTensor(ifm_index);
41 auto indices_tensor = _tensor_reg->getAclTensor(indices_index);
45 assert(n == ifm_tensor->num_dimensions());
46 size_t k = _ctx.
at(indices_index).shape().rank();
47 assert(k == indices_tensor->num_dimensions());
50 if (n != ifm_tensor->info()->num_dimensions())
55 if (k != indices_tensor->info()->num_dimensions())
61 auto fn = acl_common::generateLayer<arm_compute::CLGather>(
62 ifm_tensor->handle(), indices_tensor->handle(), ofm_tensor->handle(), axis);
65 if (ifm_tensor->dimension(0) == 1)
69 if (indices_tensor->dimension(0) == 1)
uint32_t value(void) const
std::unique_ptr< exec::IFunction > _return_fn
const Object & at(const Index &index) const
Get the object that is associated with the given index.
ARMComputeAxis ToARMComputeAxis(uint32_t rank, uint32_t axis)
void enableDimCorrection(IACLTensor *tensor)
std::unique_ptr< AclFunction > asAclFunction(std::unique_ptr<::arm_compute::IFunction > &&layer)
void disableDimCorrection(IACLTensor *tensor)