From: 박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Fri, 15 Jun 2018 00:22:47 +0000 (+0900) Subject: [Pure CL] Extract 'VectorSink' class (#1671) X-Git-Tag: 0.2~604 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c3adad7c6f43c7068c9fe8837808ec1193e072d8;p=platform%2Fcore%2Fml%2Fnnfw.git [Pure CL] Extract 'VectorSink' class (#1671) This commit extracts 'VectorSink' class into a separate file. Signed-off-by: Jonghyun Park --- diff --git a/runtimes/pure_arm_compute/src/execution.cc b/runtimes/pure_arm_compute/src/execution.cc index 194464a..d5cbb4c 100644 --- a/runtimes/pure_arm_compute/src/execution.cc +++ b/runtimes/pure_arm_compute/src/execution.cc @@ -11,6 +11,7 @@ #include "internal/arm_compute/feature/View.h" #include "internal/Sinks.h" +#include "internal/VectorSink.h" #include "internal/MatrixSink.h" #include "internal/Tensor3DSink.h" @@ -19,34 +20,6 @@ #include // -// VectorSink -// -template class VectorSink final : public Sink -{ -public: - VectorSink(const int32_t vlen, T *base, const size_t size) : _vlen{vlen}, _base{base} - { - assert(size >= _vlen * sizeof(T)); - } - -public: - void pull(::arm_compute::ITensor &tensor) const override - { - for (int32_t n = 0; n < _vlen; ++n) - { - auto from = reinterpret_cast(tensor.ptr_to_element(::arm_compute::Coordinates{n})); - auto into = _base + n; - - *into = *from; - } - } - -private: - const int32_t _vlen; - T *const _base; -}; - -// // FeatureSink // template class FeatureSink final : public Sink diff --git a/runtimes/pure_arm_compute/src/internal/VectorSink.h b/runtimes/pure_arm_compute/src/internal/VectorSink.h new file mode 100644 index 0000000..ba7dee4 --- /dev/null +++ b/runtimes/pure_arm_compute/src/internal/VectorSink.h @@ -0,0 +1,38 @@ +#ifndef __INTERNAL_VECTOR_SINK_H__ +#define __INTERNAL_VECTOR_SINK_H__ + +#include "internal/Sink.h" + +#include + +#include + +// +// VectorSink +// +template class VectorSink final : public Sink +{ +public: + VectorSink(const int32_t vlen, T *base, const size_t size) : _vlen{vlen}, _base{base} + { + assert(size >= _vlen * sizeof(T)); + } + +public: + void pull(::arm_compute::ITensor &tensor) const override + { + for (int32_t n = 0; n < _vlen; ++n) + { + auto from = reinterpret_cast(tensor.ptr_to_element(::arm_compute::Coordinates{n})); + auto into = _base + n; + + *into = *from; + } + } + +private: + const int32_t _vlen; + T *const _base; +}; + +#endif // __INTERNAL_VECTOR_SINK_H__