Description
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
- TensorFlow version and how it was installed (source or binary):
- TensorFlow-Addons version and how it was installed (source or binary):
- Python version:
- Is GPU used? (yes/no):
Describe the bug
tf.function will trigger tf.function retracing several times if user convert python types into the tf.function which will cause memory leak.
A clear and concise description of what the bug is.
Invalid usage of tf.function leads memory leak
Code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate the problem.
bazel test -c opt -k --test_timeout 300,450,1200,3600 --crosstool_top=//build_deps/toolchains/gcc7_manylinux2010-nvcc-cuda10.1:toolchain --test_output=all --jobs=1 //tensorflow_addons/activations:softshrink_test
Other info / logs
WARNING:tensorflow:9 out of the last 27 calls to <function softshrink at 0x7f37439a28c8> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings is likely due to passing python objects instead of tensors. Also, tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. Please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details.
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.