This commit introduce SPACE_TO_DEPTH operation into pure_arm_compute.
Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
void visit(const ::internal::tflite::op::Split::Node &node) override;
void visit(const ::internal::tflite::op::RSQRT::Node &node) override;
void visit(const ::internal::tflite::op::Pad::Node &node) override;
+ void visit(const ::internal::tflite::op::SpaceToDepth::Node &node) override;
private:
const ::internal::tflite::operand::Set &_ctx;
_builder.addStage(stage);
}
+void Planner::visit(const ::internal::tflite::op::SpaceToDepth::Node &node)
+{
+ // TODO Implement SPACE_TO_DEPTH op
+ throw std::runtime_error("Not supported, yet");
+}
+
class AllocationContext final : public IAllocationContext
{
public:
#include "internal/op/Split.h"
#include "internal/op/RSQRT.h"
#include "internal/op/Pad.h"
+#include "internal/op/SpaceToDepth.h"
namespace internal
{
virtual void visit(const Split::Node &) = 0;
virtual void visit(const RSQRT::Node &) = 0;
virtual void visit(const Pad::Node &) = 0;
+ virtual void visit(const SpaceToDepth::Node &) = 0;
};
} // namespace op
--- /dev/null
+#include "internal/op/SpaceToDepth.h"
+#include "internal/op/NodeVisitor.h"
+
+#include <cassert>
+
+namespace internal
+{
+namespace tflite
+{
+namespace op
+{
+namespace SpaceToDepth
+{
+
+void Node::accept(NodeVisitor &&v) const { v.visit(*this); }
+
+} // namespace SpaceToDepth
+} // namespace op
+} // namespace tflite
+} // namespace internal
+
+namespace internal
+{
+namespace tflite
+{
+namespace op
+{
+namespace SpaceToDepth
+{
+
+Param::Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount,
+ const uint32_t *outputs)
+{
+ assert(inputCount == 2 && outputCount == 1);
+
+ output_index = outputs[0];
+
+ // Each input should be interpreted as follows:
+ //
+ // 0 -> Input Tensor Index
+ // 1 -> Block size Index
+ input_index = inputs[0];
+ block_size_index = inputs[1];
+}
+
+} // namespace SpaceToDepth
+} // namespace op
+} // namespace tflite
+} // namespace internal
--- /dev/null
+#ifndef __INTERNAL_OP_SPACETODEPTH_H__
+#define __INTERNAL_OP_SPACETODEPTH_H__
+
+#include "internal/op/Node.h"
+
+#include <cstdint>
+
+namespace internal
+{
+namespace tflite
+{
+namespace op
+{
+namespace SpaceToDepth
+{
+
+struct Param
+{
+ int32_t output_index;
+
+ int32_t input_index;
+ int32_t block_size_index;
+
+ Param() = default;
+ Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs);
+};
+
+class Node final : public op::Node
+{
+public:
+ Node(const Param ¶m) : _param(param)
+ {
+ // DO NOTHING
+ }
+
+public:
+ virtual ~Node() = default;
+
+public:
+ const Param ¶m(void) const { return _param; }
+
+public:
+ void accept(NodeVisitor &&) const override;
+
+private:
+ const Param _param;
+};
+
+} // namespace SpaceToDepth
+} // namespace op
+} // namespace tflite
+} // namespace internal
+
+#endif // __INTERNAL_OP_SPACETODEPTH_H__
break;
}
+ case ANEURALNETWORKS_SPACE_TO_DEPTH:
+ {
+ using internal::tflite::op::SpaceToDepth::Param;
+ using internal::tflite::op::SpaceToDepth::Node;
+
+ auto &operations = model->deref().operations();
+
+ operations.emplace_back<Node>(Param{inputCount, inputs, outputCount, outputs});
+
+ break;
+ }
default:
throw std::runtime_error{"Not supported operation"};
};