tensorflow: TensorFlowLiteSelectTfOps: Interpreter creation fails on iOS when scheme is set to Release
System information
-
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): iOS 14.1. Development environment is Xcode 12.2 (12B45b), macOS Big Sur 11.0.1.
-
Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: iPhone SE 2016
-
TensorFlow installed from (source or binary) / TensorFlow version (use command below): pod ‘TensorFlowLiteSwift’, ‘~> 0.0.1-nightly.20201107’, :subspecs => [‘CoreML’, ‘Metal’] pod ‘TensorFlowLiteSelectTfOps’, ‘0.0.1-nightly.20201031’
Describe the current behavior
Interpreter is created successfully when target scheme’s build configuration is set to Debug. When build configuration is set to Release, it fails with:
TensorFlow Lite Error: Regular TensorFlow ops are not supported by this interpreter. Make sure you apply/link the Flex delegate before inference. TensorFlow Lite Error: Node number 6 (FlexRFFT) failed to prepare.
Describe the expected behavior
Interpreter should be created successfully in Release builds.
Standalone code to reproduce the issue
import TensorFlowLite
...
let modelPath = Bundle.main.bundleURL.appendingPathComponent("model.tflite").path
do {
let interpreter = try Interpreter(modelPath: modelPath)
try interpreter.allocateTensors()
} catch {
NSLog("\(error)")
}
Other info / logs
Can work around by going to target > Build Settings and changing Dead Code Stripping to No.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (7 by maintainers)
@clo-dan 's work-around works when running from XCode, but this issue seems to persist (even with work-around) when building/deploying to TestFlight.