Imported Upstream version 1.25.0
[platform/core/ml/nnfw.git] / onert-micro / luci-interpreter / pal / common / PALExp.h
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved
- * Copyright 2019 The TensorFlow Authors. All Rights Reserved.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved
+ * Copyright 2020 The TensorFlow Authors. 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.
  * limitations under the License.
  */
 
-#ifndef LUCI_INTERPRETER_PAL_NEG_H
-#define LUCI_INTERPRETER_PAL_NEG_H
+#ifndef LUCI_INTERPRETER_PAL_EXP_H
+#define LUCI_INTERPRETER_PAL_EXP_H
 
-#include <tensorflow/lite/kernels/internal/reference/neg.h>
+#include "PALUtils.h"
 
 namespace luci_interpreter_pal
 {
-template <typename T>
-static inline void Negate(const tflite::RuntimeShape &input_shape, const T *input_data,
-                          const tflite::RuntimeShape &output_shape, T *output_data)
+
+inline void Exp(const int flat_size, const float *input_data, float *output_data)
 {
-  tflite::reference_ops::Negate(input_shape, input_data, output_shape, output_data);
+  for (int i = 0; i < flat_size; i++)
+  {
+    const float val = input_data[i];
+    const float result = std::exp(val);
+    output_data[i] = result;
+  }
 }
+
 } // namespace luci_interpreter_pal
 
-#endif // LUCI_INTERPRETER_PAL_NEG_H
+#endif // LUCI_INTERPRETER_PAL_EXP_H