diff --git a/xla/python/pjit.cc b/xla/python/pjit.cc index a64ab9808459b0..f4c8d242a469e0 100644 --- a/xla/python/pjit.cc +++ b/xla/python/pjit.cc @@ -135,7 +135,10 @@ class PjitFunctionCache { int Size() const { return lru_list_.Size(); } int Capacity() const { return lru_list_.Capacity(); } - void Clear() { lru_list_.Clear(); } + void Clear() { + lru_list_.Clear(); + functions_.clear(); + } private: struct Key { @@ -347,6 +350,7 @@ class PjitFunctionStore { for (auto* function : compiled_functions_) { function->ClearCache(); } + compiled_functions_.clear(); } private: