diff --git a/tensorflow/lite/array.cc b/tensorflow/lite/array.cc index 21d704a76c4..4bfb8804462 100644 --- a/tensorflow/lite/array.cc +++ b/tensorflow/lite/array.cc @@ -20,6 +20,7 @@ limitations under the License. namespace tflite { namespace array_internal { +#ifndef TF_LITE_STATIC_MEMORY void TfLiteArrayDeleter::operator()(TfLiteIntArray* a) { if (a) { TfLiteIntArrayFree(a); @@ -30,6 +31,7 @@ void TfLiteArrayDeleter::operator()(TfLiteFloatArray* a) { TfLiteFloatArrayFree(a); } } +#endif // TF_LITE_STATIC_MEMORY } // namespace array_internal } // namespace tflite diff --git a/tensorflow/lite/array.h b/tensorflow/lite/array.h index 44550cd1a22..27c116f6969 100644 --- a/tensorflow/lite/array.h +++ b/tensorflow/lite/array.h @@ -70,6 +70,7 @@ using FloatArrayUniquePtr = TfLiteArrayUniquePtr; template TfLiteArrayUniquePtr BuildTfLiteArray(int size); +#ifndef TF_LITE_STATIC_MEMORY // Allocates a TfLiteIntArray of given size using malloc. template <> inline IntArrayUniquePtr BuildTfLiteArray(const int size) { @@ -81,6 +82,7 @@ template <> inline FloatArrayUniquePtr BuildTfLiteArray(const int size) { return FloatArrayUniquePtr(TfLiteFloatArrayCreate(size)); } +#endif // TF_LITE_STATIC_MEMORY // Allocates a TFLiteArray of given size and initializes it with the given // values.