From: 김정현/동작제어Lab(SR)/Senior Engineer/삼성전자 Date: Thu, 12 Apr 2018 00:44:49 +0000 (+0900) Subject: Extract CLUniqueTensor to another file (#578) X-Git-Tag: 0.1~310 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11509c01a0adfca83e6aa4dde9fad8524f5b176d;p=platform%2Fcore%2Fml%2Fnnfw.git Extract CLUniqueTensor to another file (#578) This commit extracts CLUniqueTensor to another file in order to use this class in other OpenCL NN Layers. Signed-off-by: Junghyun Kim --- diff --git a/src/kernel/acl/src/CLUniqueTensor.h b/src/kernel/acl/src/CLUniqueTensor.h new file mode 100644 index 0000000..b1c487d --- /dev/null +++ b/src/kernel/acl/src/CLUniqueTensor.h @@ -0,0 +1,47 @@ +#ifndef __NNFW_KERNEL_ACL_CLUNIQUETENSOR_H__ +#define __NNFW_KERNEL_ACL_CLUNIQUETENSOR_H__ + +#include + +namespace nnfw { +namespace kernel { +namespace acl { + +class CLUniqueTensor +{ +public: + CLUniqueTensor(const ::arm_compute::TensorInfo &info) + { + _tensor.allocator()->init(info); + } + +public: + // Both copy and move are not allowed + CLUniqueTensor(const CLUniqueTensor &) = delete; + CLUniqueTensor(CLUniqueTensor &&) = delete; + +public: + ~CLUniqueTensor() + { + _tensor.allocator()->free(); + } + +public: + void allocate() + { + _tensor.allocator()->allocate(); + } + +public: + ::arm_compute::CLTensor &ref(void) { return _tensor; } + ::arm_compute::CLTensor *ptr(void) { return &_tensor; } + +private: + ::arm_compute::CLTensor _tensor; +}; + +} // namespace acl +} // namespace kernel +} // namespace nnfw + +#endif //__NNFW_KERNEL_ACL_CLUNIQUETENSOR_H__ diff --git a/src/kernel/acl/src/cl/Conv2D.cpp b/src/kernel/acl/src/cl/Conv2D.cpp index d8afe36..4c0736d 100644 --- a/src/kernel/acl/src/cl/Conv2D.cpp +++ b/src/kernel/acl/src/cl/Conv2D.cpp @@ -6,6 +6,7 @@ #include "../IO_accessor.h" #include "../util.h" #include "../shape.h" +#include "../CLUniqueTensor.h" #include @@ -125,40 +126,6 @@ namespace nnfw { namespace kernel { namespace acl { -class CLUniqueTensor -{ -public: - CLUniqueTensor(const ::arm_compute::TensorInfo &info) - { - _tensor.allocator()->init(info); - } - -public: - // Both copy and move are not allowed - CLUniqueTensor(const CLUniqueTensor &) = delete; - CLUniqueTensor(CLUniqueTensor &&) = delete; - -public: - ~CLUniqueTensor() - { - _tensor.allocator()->free(); - - } - -public: - void allocate() - { - _tensor.allocator()->allocate(); - } - -public: - ::arm_compute::CLTensor &ref(void) { return _tensor; } - ::arm_compute::CLTensor *ptr(void) { return &_tensor; } - -private: - ::arm_compute::CLTensor _tensor; -}; - // TODO move to separate file uint32_t getNumItems(const android::nn::Shape& shape) {