Bump supported op versions to execute quantized(uint8/int8) operations.
PiperOrigin-RevId: 305939339 Change-Id: I582dca256f134a4d7a8ff69147640fcdab923971
This commit is contained in:
parent
6e840b7020
commit
b43ff5b8dd
@ -846,7 +846,7 @@ class AddOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
if (tflite_node->inputs->size != 2) {
|
||||
return absl::UnimplementedError("ADD requires two input tensors.");
|
||||
}
|
||||
@ -883,7 +883,7 @@ class ConcatenationOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
|
||||
// TODO(eignasheva): add proper tensor availability checking
|
||||
// for (uint32_t idx = 0; idx < tflite_node->inputs->size; ++idx) {
|
||||
@ -1004,7 +1004,7 @@ class Conv2DOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 3));
|
||||
RETURN_IF_ERROR(CheckInputsOutputs(context, tflite_node,
|
||||
/*runtime_inputs=*/1, /*outputs=*/1));
|
||||
RETURN_IF_ERROR(CheckTensorIsAvailable(context, tflite_node, 1));
|
||||
@ -1088,7 +1088,7 @@ class DepthwiseConvolutionOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 3));
|
||||
RETURN_IF_ERROR(CheckInputsOutputs(context, tflite_node,
|
||||
/*runtime_inputs=*/1, /*outputs=*/1));
|
||||
RETURN_IF_ERROR(CheckTensorIsAvailable(context, tflite_node, 1));
|
||||
@ -1243,7 +1243,7 @@ class ElementwiseOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
if (IsOneArgumentOperation()) {
|
||||
RETURN_IF_ERROR(CheckInputsConstsOutputs(context, tflite_node,
|
||||
/*runtime_inputs=*/1,
|
||||
@ -1411,7 +1411,7 @@ class FullyConnectedOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 4));
|
||||
TfLiteFullyConnectedParams* tf_options = nullptr;
|
||||
RETURN_IF_ERROR(RetrieveBuiltinData(tflite_node, &tf_options));
|
||||
if (tf_options->weights_format !=
|
||||
@ -1614,7 +1614,7 @@ class MulOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 3));
|
||||
if (tflite_node->inputs->size != 2) {
|
||||
return absl::UnimplementedError("MUL requires two input tensors.");
|
||||
}
|
||||
@ -1774,7 +1774,7 @@ class PadOperationParser : public TFLiteOperationParser {
|
||||
"Only Reflective padding is supported for Mirror Pad operation.");
|
||||
}
|
||||
}
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
RETURN_IF_ERROR(CheckInputsOutputs(context, tflite_node,
|
||||
/*runtime_inputs=*/1, /*outputs=*/1));
|
||||
RETURN_IF_ERROR(CheckTensorIsAvailable(context, tflite_node, 1));
|
||||
@ -1821,7 +1821,7 @@ class Pooling2DOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
TfLitePoolParams* tf_options = nullptr;
|
||||
auto status = RetrieveCustomInitialData(tflite_node, &tf_options);
|
||||
if (status.ok()) { // custom case with indices as a second output
|
||||
@ -1938,7 +1938,7 @@ class ReLUOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
@ -2111,7 +2111,7 @@ class SliceOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
@ -2191,7 +2191,7 @@ class SoftmaxOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
RETURN_IF_ERROR(CheckInputsOutputs(context, tflite_node,
|
||||
/*runtime_inputs=*/1, /*outputs=*/1));
|
||||
TfLiteSoftmaxParams* tf_options = nullptr;
|
||||
@ -2235,7 +2235,7 @@ class SpaceToDepthOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
RETURN_IF_ERROR(CheckInputsOutputs(context, tflite_node,
|
||||
/*runtime_inputs=*/1, /*outputs=*/1));
|
||||
// TODO(impjdi): Dims check.
|
||||
@ -2273,7 +2273,7 @@ class StridedSliceOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
TfLiteStridedSliceParams* tf_options = nullptr;
|
||||
RETURN_IF_ERROR(RetrieveBuiltinData(tflite_node, &tf_options));
|
||||
RETURN_IF_ERROR(CheckOptionsSupport(tf_options));
|
||||
@ -2454,7 +2454,7 @@ class TransposeConvOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
RETURN_IF_ERROR(CheckTensorIsAvailable(context, tflite_node, 1));
|
||||
TfLiteTransposeConvParams* tf_options = nullptr;
|
||||
RETURN_IF_ERROR(RetrieveBuiltinData(tflite_node, &tf_options));
|
||||
@ -2501,7 +2501,7 @@ class TransposeOperationParser : public TFLiteOperationParser {
|
||||
absl::Status IsSupported(const TfLiteContext* context,
|
||||
const TfLiteNode* tflite_node,
|
||||
const TfLiteRegistration* registration) final {
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 1));
|
||||
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 2));
|
||||
RETURN_IF_ERROR(CheckInputsOutputs(context, tflite_node,
|
||||
/*runtime_inputs=*/1, /*outputs=*/1));
|
||||
return absl::OkStatus();
|
||||
|
Loading…
Reference in New Issue
Block a user