chr5tphr / zennit

Zennit is a high-level framework in Python using PyTorch for explaining/exploring neural networks using attribution methods like LRP.
Other
183 stars 33 forks source link

Core/Composite: Simplify Composite.context #156

Open chr5tphr opened 2 years ago

chr5tphr commented 2 years ago

Composite.context can be implemented slimmer/simpler using contextlib.contextmanager. Furthermore, instead of calling Composite.context, the same functionality could be implemented as Composite.__call__, as the context is the main functionality, and this would remove a little bit of overhead, although .context may be more descriptive.