Bump FULLY_CONNECTED's supported version to v9.

New options and features introduced between v4 and v9:
v5: keep_num_dims: Not supported. Added check to FullyConnectedOperationParser to explicitly fail when flag is set.
v6: No bias provided: Was already supported in GPU, but the versioning not allowed to run these models.
v7: INT16 input/output. Integer input/output tensors are not supported.
v8: sparse_weight: Sparsity is not supported. Added check to ObjectReader::ReadTensor to reject sparse tensors.
v9: asymmetric_quantize_inputs: Controls on-the-fly quantization behavior with hybrid quant. Not relevant for GPU, as all operations are in floating-point.
PiperOrigin-RevId: 343320830
Change-Id: I4198173a83f1063099df18f531c478208f3594a6
This commit is contained in:
Robert David 2020-11-19 10:35:21 -08:00 committed by TensorFlower Gardener
parent 649966f38f
commit d2504636c4
2 changed files with 8 additions and 1 deletions
tensorflow/lite/delegates/gpu/common

View File

@ -858,7 +858,7 @@ class FullyConnectedOperationParser : public TFLiteOperationParser {
absl::Status IsSupported(const TfLiteContext* context,
const TfLiteNode* tflite_node,
const TfLiteRegistration* registration) final {
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 4));
RETURN_IF_ERROR(CheckMaxSupportedOpVersion(registration, 9));
const TfLiteFullyConnectedParams* tf_options;
RETURN_IF_ERROR(RetrieveBuiltinData(tflite_node, &tf_options));
if (tf_options->weights_format !=
@ -870,6 +870,10 @@ class FullyConnectedOperationParser : public TFLiteOperationParser {
return absl::UnimplementedError(
"FullyConnected doesn't support more than 2 runtime inputs.");
}
if (tf_options->keep_num_dims == true) {
return absl::UnimplementedError(
"FullyConnected doesn't support keep_num_dims.");
}
// TODO(eignasheva): check input shape
return absl::OkStatus();
}

View File

@ -71,6 +71,9 @@ class ObjectReader {
}
const TfLiteTensor* tflite_tensor = context_->tensors + tensor_idx;
if (tflite_tensor->sparsity != nullptr) {
return absl::InvalidArgumentError("Sparsity is not supported on GPU.");
}
t->data.resize(NumElements(tflite_tensor));
RETURN_IF_ERROR(CreateVectorCopyData(*tflite_tensor, &t->data[0]));