You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have you reproduced the bug with TensorFlow Nightly?
No
Source
binary from pip
TensorFlow version
2.16.1
Custom code
Yes
OS platform and distribution
Linux Ubuntu 24.04
Mobile device
No response
Python version
3.12.3
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
I believe I tracked down a memory leak in my code to a tf.constant creation in a short lived object of a class. I can reproduce it in an even simpler way by just creating the constant in a loop. No @tf.function decoration or model training necessary to cause it. It seems to happen if I replace the tf.constant with a tf.random.uniform(). I tried suggestions I've seen elsewhere, like trying to use del on the variable followed by gc.collect().
I have two machines. Both have TF 2.16.1. However, running the same code on the one with python 3.10 does not leak, while the machine (in the OP) with 3.12 does leak.
edit: I added a print(sys.version) to your gist, it looks like it's using 3.10:
2.16.1
3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
No
Source
binary from pip
TensorFlow version
2.16.1
Custom code
Yes
OS platform and distribution
Linux Ubuntu 24.04
Mobile device
No response
Python version
3.12.3
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
I believe I tracked down a memory leak in my code to a
tf.constant
creation in a short lived object of a class. I can reproduce it in an even simpler way by just creating the constant in a loop. No@tf.function
decoration or model training necessary to cause it. It seems to happen if I replace thetf.constant
with atf.random.uniform()
. I tried suggestions I've seen elsewhere, like trying to usedel
on the variable followed bygc.collect()
.Some similar looking bug reports:
It looks like upgrading to 2.15 solved it for some people, but it appears to be back in 2.16?
is this expected and I'm doing something wrong?
Standalone code to reproduce the issue
The text was updated successfully, but these errors were encountered: