17#include "../KernelGenerator.h"
18#include "../Validator.h"
25void Validator::visit(
const ir::operation::BatchToSpaceND &) {
_supported =
true; }
27void KernelGenerator::visit(
const ir::operation::BatchToSpaceND &node)
29 const auto ofm_index{node.getOutputs().at(0)};
31 const auto block_size_index{
34 const auto NNApiInputs = 2;
35 if (node.getInputs().size() != NNApiInputs)
38 if (!_ctx.
at(crops_index).isConstant())
40 throw std::runtime_error(
"Non-constant crops NYI for acl_neon backend BatchToSpaceND");
43 auto crops = _ctx.
at(crops_index).asVector<int32_t>();
44 for (
auto &&crop : crops)
48 throw std::runtime_error(
"Non-zero crops NYI for acl_neon backend BatchToSpaceND");
53 auto ofm_tensor = _tensor_reg->getAclTensor(ofm_index);
54 auto ifm_tensor = _tensor_reg->getAclTensor(ifm_index);
56 if (!_ctx.
at(block_size_index).data())
57 throw std::runtime_error(
"ACL NEON does not support dynamic block size for BatchToSpaceND");
59 auto block = _ctx.
at(block_size_index).asVector<int32_t>();
60 int32_t height = block[0];
61 int32_t width = block[1];
63 auto fn = acl_common::generateLayer<arm_compute::NEBatchToSpaceLayer>(
64 ifm_tensor->handle(), width, height, ofm_tensor->handle());
std::unique_ptr< exec::IFunction > _return_fn
const Object & at(const Index &index) const
Get the object that is associated with the given index.
std::unique_ptr< AclFunction > asAclFunction(std::unique_ptr<::arm_compute::IFunction > &&layer)