deel-ai / oodeel

Simple, compact, and hackable post-hoc deep OOD detection for already trained tensorflow or pytorch image classifiers.
https://deel-ai.github.io/oodeel/
MIT License
52 stars 2 forks source link

Remove tf.function in gradient operator to avoid multiple useless retracings #53

Closed cofri closed 1 year ago

cofri commented 1 year ago

The tf.function decorator on the gradient function operator was slowing down because of multiple retracings. Removing it speeds up the computation.

Adding tf.function on ODIN input_perturbation() function was the fastest option but input_perturbation() would not be framework-agnostic anymore.

As a temporary hotfix, we remove @tf.function decorator from gradient method to prevent useless raytracing. We will work on a more long-term solution in a future PR (see issue #52) .

github-actions[bot] commented 1 year ago

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1613 1453 90% 70% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
oodeel/utils/tf_operator.py 96% 🟢
TOTAL 96% 🟢

updated for commit: 665bb1b by action🐍