Skip to content

Commit

Permalink
Merge pull request tensorflow#55805 from DEKHTIARJonathan:tftrt/py_un…
Browse files Browse the repository at this point in the history
…ittest_gc-bugfix

PiperOrigin-RevId: 448978713
  • Loading branch information
tensorflower-gardener committed May 16, 2022
2 parents 7e5bc18 + 28d6a43 commit c6467e7
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ def setUp(self):
if not is_tensorrt_enabled():
self.skipTest("Test requires TensorRT")

def tearDown(self):
"""Making sure to clean artifact."""
idx = 0
while gc.garbage:
gc.collect() # Force GC to destroy the TRT engine cache.
idx += 1
if idx >= 10: # After 10 iterations, break to avoid infinite collect.
break

def _GetTensorSpec(self, shape, mask, dtype, name):
# Set dimension i to None if mask[i] == False
assert len(shape) == len(mask)
Expand Down

0 comments on commit c6467e7

Please sign in to comment.