[neurun] Add skeleton of tensor conversion kernels (#2065)
author김수진/동작제어Lab(SR)/Engineer/삼성전자 <sjsujin.kim@samsung.com>
Tue, 31 Jul 2018 07:44:19 +0000 (16:44 +0900)
committer이춘석/동작제어Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Tue, 31 Jul 2018 07:44:19 +0000 (16:44 +0900)
* [neurun] Add skeleton of tensor conversion kernels

Related : #1974

This commit adds skeleton of tensor conversion kernels inherited arm_compute::IFunction.

It's part PR of #2056(https://github.sec.samsung.net/STAR/nnfw/pull/2056#issuecomment-128722)

Signed-off-by: sjsujinkim <sjsujin.kim@samsung.com>
* Seperate specific layers and apply common tensor

runtimes/neurun/src/kernel/acl_cl/TensorConvertFromCommonLayer.cc [new file with mode: 0644]
runtimes/neurun/src/kernel/acl_cl/TensorConvertFromCommonLayer.h [new file with mode: 0644]
runtimes/neurun/src/kernel/acl_cl/TensorConvertToCommonLayer.cc [new file with mode: 0644]
runtimes/neurun/src/kernel/acl_cl/TensorConvertToCommonLayer.h [new file with mode: 0644]
runtimes/neurun/src/kernel/cpufallback/TensorConvertFromCommonLayer.cc [new file with mode: 0644]
runtimes/neurun/src/kernel/cpufallback/TensorConvertFromCommonLayer.h [new file with mode: 0644]
runtimes/neurun/src/kernel/cpufallback/TensorConvertToCommonLayer.cc [new file with mode: 0644]
runtimes/neurun/src/kernel/cpufallback/TensorConvertToCommonLayer.h [new file with mode: 0644]

diff --git a/runtimes/neurun/src/kernel/acl_cl/TensorConvertFromCommonLayer.cc b/runtimes/neurun/src/kernel/acl_cl/TensorConvertFromCommonLayer.cc
new file mode 100644 (file)
index 0000000..6885817
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TensorConvertFromCommonLayer.h"
+
+#include "logging.h"
+
+namespace internal
+{
+namespace kernel
+{
+namespace acl_cl
+{
+
+bool TensorConvertFromCommonLayer::convert()
+{
+  VERBOSE(TensorConvertFromCommonLayer)
+      << "Tensor conversion from common, but it is not yet implemented." << std::endl;
+  return true;
+}
+
+void TensorConvertFromCommonLayer::configure(::internal::common::Tensor *inputTensor,
+                                             ::arm_compute::ICLTensor *outputTensor)
+{
+  _inputTensor = inputTensor;
+  _outputTensor = outputTensor;
+}
+
+void TensorConvertFromCommonLayer::run() { convert(); }
+
+} // namespace acl_cl
+} // namespace kernel
+} // namespace internal
diff --git a/runtimes/neurun/src/kernel/acl_cl/TensorConvertFromCommonLayer.h b/runtimes/neurun/src/kernel/acl_cl/TensorConvertFromCommonLayer.h
new file mode 100644 (file)
index 0000000..3b79ca1
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __INTERNAL_KERNELS_ACL_CL_TENSOR_CONVERT_FROM_COMMON_LAYER_H__
+#define __INTERNAL_KERNELS_ACL_CL_TENSOR_CONVERT_FROM_COMMON_LAYER_H__
+
+#include <NeuralNetworks.h>
+
+#include <arm_compute/runtime/IFunction.h>
+#include <arm_compute/core/CL/ICLTensor.h>
+
+#include "internal/Model.h"
+#include "internal/common/Tensor.h"
+
+namespace internal
+{
+namespace kernel
+{
+namespace acl_cl
+{
+
+class TensorConvertFromCommonLayer : public ::arm_compute::IFunction
+{
+public:
+  TensorConvertFromCommonLayer() {}
+
+public:
+  bool convert();
+
+  void configure(::internal::common::Tensor *inputTensor, ::arm_compute::ICLTensor *outputTensor);
+
+  void run();
+
+private:
+  ::internal::common::Tensor *_inputTensor;
+  ::arm_compute::ICLTensor *_outputTensor;
+};
+
+} // namespace acl_cl
+} // namespace kernel
+} // namespace internal
+
+#endif // __INTERNAL_KERNELS_ACL_CL_TENSOR_CONVERT_FROM_COMMON_LAYER_H__
diff --git a/runtimes/neurun/src/kernel/acl_cl/TensorConvertToCommonLayer.cc b/runtimes/neurun/src/kernel/acl_cl/TensorConvertToCommonLayer.cc
new file mode 100644 (file)
index 0000000..45781e8
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TensorConvertToCommonLayer.h"
+
+#include "logging.h"
+
+namespace internal
+{
+namespace kernel
+{
+namespace acl_cl
+{
+
+bool TensorConvertToCommonLayer::convert()
+{
+  VERBOSE(TensorConvertToCommonLayer)
+      << "Tensor conversion to common, but it is not yet implemented." << std::endl;
+  return true;
+}
+
+void TensorConvertToCommonLayer::configure(::arm_compute::ICLTensor *inputTensor,
+                                           ::internal::common::Tensor *outputTensor)
+{
+  _inputTensor = inputTensor;
+  _outputTensor = outputTensor;
+}
+
+void TensorConvertToCommonLayer::run() { convert(); }
+
+} // namespace acl_cl
+} // namespace kernel
+} // namespace internal
diff --git a/runtimes/neurun/src/kernel/acl_cl/TensorConvertToCommonLayer.h b/runtimes/neurun/src/kernel/acl_cl/TensorConvertToCommonLayer.h
new file mode 100644 (file)
index 0000000..1214afa
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __INTERNAL_KERNELS_ACL_CL_TENSOR_CONVERT_TO_COMMON_LAYER_H__
+#define __INTERNAL_KERNELS_ACL_CL_TENSOR_CONVERT_TO_COMMON_LAYER_H__
+
+#include <NeuralNetworks.h>
+
+#include <arm_compute/runtime/IFunction.h>
+#include <arm_compute/core/CL/ICLTensor.h>
+
+#include "internal/Model.h"
+#include "internal/common/Tensor.h"
+
+namespace internal
+{
+namespace kernel
+{
+namespace acl_cl
+{
+
+class TensorConvertToCommonLayer : public ::arm_compute::IFunction
+{
+public:
+  TensorConvertToCommonLayer() {}
+
+public:
+  bool convert();
+
+  void configure(::arm_compute::ICLTensor *inputTensor, ::internal::common::Tensor *outputTensor);
+
+  void run();
+
+private:
+  ::arm_compute::ICLTensor *_inputTensor;
+  ::internal::common::Tensor *_outputTensor;
+};
+
+} // namespace acl_cl
+} // namespace kernel
+} // namespace internal
+
+#endif // __INTERNAL_KERNELS_ACL_CL_TENSOR_CONVERT_TO_COMMON_LAYER_H__
diff --git a/runtimes/neurun/src/kernel/cpufallback/TensorConvertFromCommonLayer.cc b/runtimes/neurun/src/kernel/cpufallback/TensorConvertFromCommonLayer.cc
new file mode 100644 (file)
index 0000000..8264d7f
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TensorConvertFromCommonLayer.h"
+
+#include "logging.h"
+
+namespace internal
+{
+namespace kernel
+{
+namespace cpu
+{
+
+bool TensorConvertFromCommonLayer::convert()
+{
+  VERBOSE(TensorConvertFromCommonLayer)
+      << "Tensor conversion from common, but it is not yet implemented." << std::endl;
+  return true;
+}
+
+void TensorConvertFromCommonLayer::configure(::internal::common::Tensor *inputData,
+                                             uint8_t *outputData)
+{
+  _inputData = inputData;
+  _outputData = outputData;
+}
+
+void TensorConvertFromCommonLayer::run() { convert(); }
+
+} // namespace cpu
+} // namespace kernel
+} // namespace internal
diff --git a/runtimes/neurun/src/kernel/cpufallback/TensorConvertFromCommonLayer.h b/runtimes/neurun/src/kernel/cpufallback/TensorConvertFromCommonLayer.h
new file mode 100644 (file)
index 0000000..fd745bb
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __INTERNAL_KERNELS_CPU_TENSOR_CONVERT_FROM_COMMON_LAYER_H__
+#define __INTERNAL_KERNELS_CPU_TENSOR_CONVERT_FROM_COMMON_LAYER_H__
+
+#include <NeuralNetworks.h>
+
+#include <arm_compute/runtime/IFunction.h>
+
+#include "internal/Model.h"
+#include "internal/common/Tensor.h"
+
+namespace internal
+{
+namespace kernel
+{
+namespace cpu
+{
+
+class TensorConvertFromCommonLayer : public ::arm_compute::IFunction
+{
+public:
+  TensorConvertFromCommonLayer() {}
+
+public:
+  bool convert();
+
+  void configure(::internal::common::Tensor *inputData, uint8_t *outputData);
+
+  void run();
+
+private:
+  ::internal::common::Tensor *_inputData;
+  uint8_t *_outputData;
+};
+
+} // namespace cpu
+} // namespace kernel
+} // namespace internal
+
+#endif // __INTERNAL_KERNELS_CPU_TENSOR_CONVERT_FROM_COMMON_LAYER_H__
diff --git a/runtimes/neurun/src/kernel/cpufallback/TensorConvertToCommonLayer.cc b/runtimes/neurun/src/kernel/cpufallback/TensorConvertToCommonLayer.cc
new file mode 100644 (file)
index 0000000..7408561
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TensorConvertToCommonLayer.h"
+
+#include "logging.h"
+
+namespace internal
+{
+namespace kernel
+{
+namespace cpu
+{
+
+bool TensorConvertToCommonLayer::convert()
+{
+  VERBOSE(ConvertToCommon) << "Tensor conversion to common, but it is not yet implemented."
+                           << std::endl;
+  return true;
+}
+
+void TensorConvertToCommonLayer::configure(uint8_t *inputData,
+                                           ::internal::common::Tensor *outputData)
+{
+  _inputData = inputData;
+  _outputData = outputData;
+}
+
+void TensorConvertToCommonLayer::run() { convert(); }
+
+} // namespace cpu
+} // namespace kernel
+} // namespace internal
diff --git a/runtimes/neurun/src/kernel/cpufallback/TensorConvertToCommonLayer.h b/runtimes/neurun/src/kernel/cpufallback/TensorConvertToCommonLayer.h
new file mode 100644 (file)
index 0000000..738ffa5
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __INTERNAL_KERNELS_CPU_TENSOR_CONVERT_TO_COMMON_LAYER_H__
+#define __INTERNAL_KERNELS_CPU_TENSOR_CONVERT_TO_COMMON_LAYER_H__
+
+#include <NeuralNetworks.h>
+
+#include <arm_compute/runtime/IFunction.h>
+
+#include "internal/Model.h"
+#include "internal/common/Tensor.h"
+
+namespace internal
+{
+namespace kernel
+{
+namespace cpu
+{
+
+class TensorConvertToCommonLayer : public ::arm_compute::IFunction
+{
+public:
+  TensorConvertToCommonLayer() {}
+
+public:
+  bool convert();
+
+  void configure(uint8_t *inputData, ::internal::common::Tensor *outputData);
+
+  void run();
+
+private:
+  uint8_t *_inputData;
+  ::internal::common::Tensor *_outputData;
+};
+
+} // namespace cpu
+} // namespace kernel
+} // namespace internal
+
+#endif // __INTERNAL_KERNELS_CPU_TENSOR_CONVERT_TO_COMMON_LAYER_H__