TFLite Python API: allow float64, uint64 and complex128

I was confused by the error message saying that the interpreter got UNKNOWN type, which actually turns out to be float64.

Also removes a confusing comment. Since the input type is `int` not `enum`. -Wswitch-enum won't help.

PiperOrigin-RevId: 347300840
Change-Id: I732731871e969ae53e88c9cd7ffffdbd1ac8e314
This commit is contained in:
Tiezhen WANG 2020-12-13 18:43:06 -08:00 committed by TensorFlower Gardener
parent edc060801f
commit 1e8c13a7f0

View File

@ -73,6 +73,8 @@ TfLiteType TfLiteTypeFromPyType(int py_type) {
return kTfLiteFloat32;
case NPY_FLOAT16:
return kTfLiteFloat16;
case NPY_FLOAT64:
return kTfLiteFloat64;
case NPY_INT32:
return kTfLiteInt32;
case NPY_INT16:
@ -83,6 +85,8 @@ TfLiteType TfLiteTypeFromPyType(int py_type) {
return kTfLiteInt8;
case NPY_INT64:
return kTfLiteInt64;
case NPY_UINT64:
return kTfLiteUInt64;
case NPY_BOOL:
return kTfLiteBool;
case NPY_OBJECT:
@ -91,7 +95,8 @@ TfLiteType TfLiteTypeFromPyType(int py_type) {
return kTfLiteString;
case NPY_COMPLEX64:
return kTfLiteComplex64;
// Avoid default so compiler errors created when new types are made.
case NPY_COMPLEX128:
return kTfLiteComplex128;
}
return kTfLiteNoType;
}