TFLM: Remove <complex> header from portable_type_to_tflitetype.h

<complex> header is not available on all platforms.

PiperOrigin-RevId: 350455138
Change-Id: Ie92170a4f9ec6d795679dce3739c9a3e573dba86
This commit is contained in:
Tiezhen WANG 2021-01-06 17:02:13 -08:00 committed by TensorFlower Gardener
parent f506272622
commit c08aed3096
2 changed files with 8 additions and 8 deletions

View File

@ -16,8 +16,8 @@ limitations under the License.
#define TENSORFLOW_LITE_PORTABLE_TYPE_TO_TFLITETYPE_H_
// Most of the definitions have been moved to this subheader so that Micro
// can include it without relying on <string>, which isn't available on all
// platforms.
// can include it without relying on <string> and <complex>, which isn't
// available on all platforms.
// Arduino build defines abs as a macro here. That is invalid C++, and breaks
// libc++'s <complex> header, undefine it.
@ -25,8 +25,6 @@ limitations under the License.
#undef abs
#endif
#include <complex>
#include "tensorflow/lite/c/common.h"
namespace tflite {
@ -65,8 +63,6 @@ MATCH_TYPE_AND_TFLITE_TYPE(float, kTfLiteFloat32);
MATCH_TYPE_AND_TFLITE_TYPE(unsigned char, kTfLiteUInt8);
MATCH_TYPE_AND_TFLITE_TYPE(int8_t, kTfLiteInt8);
MATCH_TYPE_AND_TFLITE_TYPE(bool, kTfLiteBool);
MATCH_TYPE_AND_TFLITE_TYPE(std::complex<float>, kTfLiteComplex64);
MATCH_TYPE_AND_TFLITE_TYPE(std::complex<double>, kTfLiteComplex128);
MATCH_TYPE_AND_TFLITE_TYPE(TfLiteFloat16, kTfLiteFloat16);
MATCH_TYPE_AND_TFLITE_TYPE(double, kTfLiteFloat64);
MATCH_TYPE_AND_TFLITE_TYPE(uint64_t, kTfLiteUInt64);

View File

@ -15,13 +15,14 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_TYPE_TO_TFLITETYPE_H_
#define TENSORFLOW_LITE_TYPE_TO_TFLITETYPE_H_
#include <complex>
#include <string>
#include "tensorflow/lite/c/common.h"
// Most of the definitions have been moved to this subheader so that Micro
// can include it without relying on <string>, which isn't available on all
// platforms.
// can include it without relying on <string> and <complex>, which isn't
// available on all platforms.
#include "tensorflow/lite/portable_type_to_tflitetype.h"
namespace tflite {
@ -30,5 +31,8 @@ namespace tflite {
// in a string tensor will be returned as a std::string, so it's deprecated.
MATCH_TYPE_AND_TFLITE_TYPE(std::string, kTfLiteString);
MATCH_TYPE_AND_TFLITE_TYPE(std::complex<float>, kTfLiteComplex64);
MATCH_TYPE_AND_TFLITE_TYPE(std::complex<double>, kTfLiteComplex128);
} // namespace tflite
#endif // TENSORFLOW_LITE_TYPE_TO_TFLITETYPE_H_