void visit(const ::internal::tflite::op::RNN::Node &node) override;
void visit(const ::internal::tflite::op::LSTM::Node &node) override;
void visit(const ::internal::tflite::op::Floor::Node &node) override;
+ void visit(const ::internal::tflite::op::Split::Node &node) override;
private:
const ::internal::tflite::operand::Set &_ctx;
_builder.addStage(stage);
}
+void Planner::visit(const ::internal::tflite::op::Split::Node &node)
+{
+ VERBOSE(Split) << "Configure Split operation" << std::endl;
+
+ throw std::runtime_error("Not supported, yet");
+}
+
class AllocationContext final : public IAllocationContext
{
public:
#include "internal/op/Rnn.h"
#include "internal/op/Lstm.h"
#include "internal/op/Floor.h"
+#include "internal/op/Split.h"
namespace internal
{
virtual void visit(const RNN::Node &) = 0;
virtual void visit(const LSTM::Node &) = 0;
virtual void visit(const Floor::Node &) = 0;
+ virtual void visit(const Split::Node &) = 0;
};
} // namespace op
--- /dev/null
+#include "internal/op/Split.h"
+#include "internal/op/NodeVisitor.h"
+
+#include <cassert>
+
+namespace internal
+{
+namespace tflite
+{
+namespace op
+{
+namespace Split
+{
+
+void Node::accept(NodeVisitor &&v) const { v.visit(*this); }
+
+} // namespace Split
+} // namespace op
+} // namespace tflite
+} // namespace internal
+
+namespace internal
+{
+namespace tflite
+{
+namespace op
+{
+namespace Split
+{
+
+Param::Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount,
+ const uint32_t *outputs)
+{
+ assert(inputCount == 2);
+
+ // Each input should be interpreted as follows:
+ // 0 -> A 0-D int32 tensor, indicating the dimension along which to split.
+ // 1 -> An n-D tensor, specifying the tensor to be split.
+ axis_index = inputs[0];
+ ifm_index = inputs[1];
+
+ // Each output should be interpreted as follow:
+ // [0, outputCount) -> An n-D tensor.
+ for (uint32_t n = 0; n < outputCount; ++n)
+ {
+ ofm_indexes.emplace_back(outputs[n]);
+ }
+}
+
+} // namespace Split
+} // namespace op
+} // namespace tflite
+} // namespace internal
--- /dev/null
+#ifndef __INTERNAL_OP_SPLIT_H__
+#define __INTERNAL_OP_SPLIT_H__
+
+#include "internal/op/Node.h"
+
+#include <cstdint>
+#include <vector>
+
+namespace internal
+{
+namespace tflite
+{
+namespace op
+{
+namespace Split
+{
+
+struct Param
+{
+ int32_t axis_index;
+ int32_t ifm_index;
+
+ std::vector<int32_t> ofm_indexes;
+
+ 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 Split
+} // namespace op
+} // namespace tflite
+} // namespace internal
+
+#endif // __INTERNAL_OP_SPLIT_H__
break;
}
+ case ANEURALNETWORKS_SPLIT_EX:
+ {
+ using internal::tflite::op::Split::Param;
+ using internal::tflite::op::Split::Node;
+
+ // Add 'operations'
+ auto &operations = model->deref().operations();
+
+ operations.emplace_back<Node>(Param{inputCount, inputs, outputCount, outputs});
+
+ break;
+ }
default:
throw std::runtime_error{"Not supported operation"};
}