Skip to content

Commit a807a5a

Browse files
mzientstiepan
authored andcommitted
Add a function that purges operator instance cache for an EvalContext. (#6216)
* Add a function that purges operator instance cache for an EvalContext. --------- Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
1 parent 57563f7 commit a807a5a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

dali/python/nvidia/dali/experimental/dynamic/_eval_context.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ def __init__(self, *, num_threads=None, device_id=None, cuda_stream=None):
169169
self._async_executor = _AsyncExecutor()
170170
weakref.finalize(self, self._async_executor.shutdown)
171171

172+
def _purge_operator_cache(self):
173+
"""Empties the operator instance cache"""
174+
self._instance_cache = {}
175+
172176
@property
173177
def _thread_pool(self):
174178
if (

dali/test/python/ndd_vs_fn/ndd_vs_fn_test_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ def run_operator_test(
521521
batch_size : int, optional
522522
Max batch size used when building the pipeline.
523523
"""
524+
ndd.EvalContext.current()._purge_operator_cache()
525+
524526
if operator_args is None:
525527
operator_args = {}
526528

0 commit comments

Comments
 (0)