Make cache writes optional in InferenceCalculatorAdvancedGL

Previously, caches were always written, and an error would cause the graph to close abruptly. This prevented services with read-only access to the cache from using the calculator.

The new behavior allows services to choose whether or not to write caches.

PiperOrigin-RevId: 561866791
This commit is contained in:
MediaPipe Team
2023-08-31 23:31:27 -07:00
committed by Copybara-Service
parent dea6ccba25
commit de0c7f2a30
3 changed files with 55 additions and 2 deletions
@@ -122,6 +122,8 @@ describe('TaskRunner', () => {
allowPrecisionLoss: true,
cachedKernelPath: undefined,
serializedModelDir: undefined,
cacheWritingBehavior: InferenceCalculatorOptions.Delegate.Gpu
.CacheWritingBehavior.WRITE_OR_ERROR,
modelToken: undefined,
usage: InferenceCalculatorOptions.Delegate.Gpu.InferenceUsage
.SUSTAINED_SPEED,