diff --git a/mediapipe/calculators/tensor/inference_calculator_cpu.cc b/mediapipe/calculators/tensor/inference_calculator_cpu.cc index 79df97638..46804b6fd 100644 --- a/mediapipe/calculators/tensor/inference_calculator_cpu.cc +++ b/mediapipe/calculators/tensor/inference_calculator_cpu.cc @@ -151,6 +151,8 @@ InferenceCalculatorCpuImpl::MaybeCreateDelegate(CalculatorContext* cc) { auto xnnpack_opts = TfLiteXNNPackDelegateOptionsDefault(); xnnpack_opts.num_threads = GetXnnpackNumThreads(opts_has_delegate, opts_delegate); + // TODO Remove once XNNPACK is enabled by default. + xnnpack_opts.flags |= TFLITE_XNNPACK_DELEGATE_FLAG_QU8; return TfLiteDelegatePtr(TfLiteXNNPackDelegateCreate(&xnnpack_opts), &TfLiteXNNPackDelegateDelete); } diff --git a/mediapipe/calculators/tensor/inference_calculator_xnnpack.cc b/mediapipe/calculators/tensor/inference_calculator_xnnpack.cc index a9417d508..4212534a1 100644 --- a/mediapipe/calculators/tensor/inference_calculator_xnnpack.cc +++ b/mediapipe/calculators/tensor/inference_calculator_xnnpack.cc @@ -114,6 +114,8 @@ InferenceCalculatorXnnpackImpl::CreateDelegate(CalculatorContext* cc) { auto xnnpack_opts = TfLiteXNNPackDelegateOptionsDefault(); xnnpack_opts.num_threads = GetXnnpackNumThreads(opts_has_delegate, opts_delegate); + // TODO Remove once XNNPACK is enabled by default. + xnnpack_opts.flags |= TFLITE_XNNPACK_DELEGATE_FLAG_QU8; return TfLiteDelegatePtr(TfLiteXNNPackDelegateCreate(&xnnpack_opts), &TfLiteXNNPackDelegateDelete); } diff --git a/mediapipe/calculators/tflite/tflite_inference_calculator.cc b/mediapipe/calculators/tflite/tflite_inference_calculator.cc index 027e4446d..afdc9ed6f 100644 --- a/mediapipe/calculators/tflite/tflite_inference_calculator.cc +++ b/mediapipe/calculators/tflite/tflite_inference_calculator.cc @@ -941,6 +941,8 @@ absl::Status TfLiteInferenceCalculator::LoadDelegate(CalculatorContext* cc) { if (use_xnnpack) { auto xnnpack_opts = TfLiteXNNPackDelegateOptionsDefault(); xnnpack_opts.num_threads = GetXnnpackNumThreads(calculator_opts); + // TODO Remove once XNNPACK is enabled by default. + xnnpack_opts.flags |= TFLITE_XNNPACK_DELEGATE_FLAG_QU8; delegate_ = TfLiteDelegatePtr(TfLiteXNNPackDelegateCreate(&xnnpack_opts), &TfLiteXNNPackDelegateDelete); RET_CHECK_EQ(interpreter_->ModifyGraphWithDelegate(delegate_.get()),