Make XNNPack reject spasre FullyConnected op by checking op version.

PiperOrigin-RevId: 340997353
Change-Id: I6f1d96da83136552cad8582b17237f15f4f064d9
This commit is contained in:
Yunlu Li 2020-11-05 23:39:47 -08:00 committed by TensorFlower Gardener
parent 1d2800b2f8
commit 18ec783484

View File

@ -859,6 +859,15 @@ class Subgraph {
context->tensors, div_params, xnnpack_tensors);
}
case kTfLiteBuiltinFullyConnected: {
// FullyConnected with sparse weight has version 8, which cannot be
// delegated to XNNPack.
if (registration->version == 8) {
TF_LITE_MAYBE_KERNEL_LOG(logging_context,
"Unsupported version %d of FullyConnected.",
registration->version);
return kTfLiteError;
}
const TfLiteFullyConnectedParams* fc_params =
static_cast<const TfLiteFullyConnectedParams*>(node->builtin_data);