Move `internal/cpu.{h|cc}` to cpu backend directory.
Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
#include "backend/IStageGenerator.h"
#include "graph/operand/Set.h"
-#include "internal/cpu.h"
+#include "backend/cpu/operand/Tensor.h"
#include "TensorBuilder.h"
namespace neurun
for (auto ind_int : _inds)
{
::neurun::graph::operand::Index ind{ind_int};
- auto tensor = std::make_shared<::internal::cpu::Tensor>(tensor_info_ctx.at(ind.asInt()));
+ auto tensor = std::make_shared<operand::Tensor>(tensor_info_ctx.at(ind.asInt()));
// TODO Fix allocation here. When Tensor object is created the memory for tensor is also
// allocated, and this must be fixed.
_plan.operands().set(ind, std::make_shared<operand::Object>(tensor));
// See also: comment in `prepare()`
}
-std::shared_ptr<::internal::cpu::Tensor>
-TensorBuilder::at(const ::neurun::graph::operand::Index &ind)
+std::shared_ptr<operand::Tensor> TensorBuilder::at(const ::neurun::graph::operand::Index &ind)
{
return _tensors.at(ind.asInt());
}
#include <unordered_set>
#include "backend/ITensorBuilder.h"
-#include "internal/cpu.h"
+#include "backend/cpu/operand/Tensor.h"
#include "codegen/Plan.h"
namespace neurun
virtual void prepare(const std::map<int, ::arm_compute::TensorInfo> &tensor_info_ctx) override;
virtual void allocate(void) override;
- std::shared_ptr<::internal::cpu::Tensor> at(const ::neurun::graph::operand::Index &ind);
+ std::shared_ptr<operand::Tensor> at(const ::neurun::graph::operand::Index &ind);
private:
codegen::Plan &_plan;
std::unordered_set<int> _inds;
- std::unordered_map<int, std::shared_ptr<::internal::cpu::Tensor>> _tensors;
+ std::unordered_map<int, std::shared_ptr<operand::Tensor>> _tensors;
};
} // namespace cpu
--- /dev/null
+#include "Tensor.h"
+
+namespace neurun
+{
+namespace backend
+{
+namespace cpu
+{
+namespace operand
+{
+
+// NO IMPLEMENTATION YET
+
+} // namespace operand
+} // namespace cpu
+} // namespace backend
+} // namespace neurun
-#ifndef __INTERNAL_CPU_H__
-#define __INTERNAL_CPU_H__
+#ifndef __NEURUN_BACKEND_CPU_OPERAND_TENSOR_H__
+#define __NEURUN_BACKEND_CPU_OPERAND_TENSOR_H__
#include <arm_compute/core/ITensor.h>
#include <arm_compute/core/TensorInfo.h>
-#include <arm_compute/core/CL/OpenCL.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <iostream>
-
-namespace internal
+namespace neurun
+{
+namespace backend
{
namespace cpu
{
+namespace operand
+{
class Tensor : public ::arm_compute::ITensor
{
uint8_t *_buffer = nullptr;
};
-} // cpu
-} // internal
+} // namespace operand
+} // namespace cpu
+} // namespace backend
+} // namespace neurun
-#endif // __INTERNAL_CPU_H__
+#endif // __NEURUN_BACKEND_CPU_OPERAND_TENSOR_H__
#include <util/feature/Shape.h>
#include <util/feature/IndexIterator.h>
-#include "internal/cpu.h"
+#include "backend/cpu/operand/Tensor.h" // TODO Remove this dependency to backend
#include "internal/nnapi/feature/View.h"
#include "internal/nnapi/feature/Reader.h"
void pull(::arm_compute::ITensor &tensor) const override
{
// TODO: This is just workaround codes, It needs to refactor.
- if (typeid(tensor) == typeid(::internal::cpu::Tensor))
+ if (typeid(tensor) == typeid(neurun::backend::cpu::operand::Tensor))
{
const ::internal::nnapi::feature::Reader<float> from{_shape, tensor.buffer(), _size};
::internal::nnapi::feature::View<float> into{_shape, _base, _size};
#include <util/feature/Shape.h>
#include <util/feature/IndexIterator.h>
-#include "internal/cpu.h"
+#include "backend/cpu/operand/Tensor.h" // TODO Remove this dependency to backend
#include "internal/nnapi/feature/Reader.h"
#include "internal/nnapi/feature/View.h"
void push(::arm_compute::ITensor &tensor) const override
{
// TODO: This is just workaround codes, It needs to refactor.
- if (typeid(tensor) == typeid(::internal::cpu::Tensor))
+ if (typeid(tensor) == typeid(neurun::backend::cpu::operand::Tensor))
{
const ::internal::nnapi::feature::Reader<float> from{_shape, _base, _size};
::internal::nnapi::feature::View<float> into{_shape, tensor.buffer(), _size};
+++ /dev/null
-#include "internal/cpu.h"