tf.keras.utils.get_file inconsistent behavior with keras.utils.get_file
System information
- OS Platform and Distribution: Colab
- TensorFlow version: v2.2.0-rc3-0-gaad398b5e9 2.2.0-rc3
- Python version: 3.6.9
Describe the current behavior
tensorflow.keras.utils.get_file by default saves any file to a subdirectory of ~/.keras. This behavior is specified here.
Describe the expected behavior
The function should behave the same as keras.utils.get_file, which uses the path specified in the KERAS_HOME environment variable instead of ~/.keras if it is set. This behavior is specified here
Standalone code to reproduce the issue
https://colab.research.google.com/drive/1pfS-BgACkgkCQ9nXT_iz123lvdlTk9Hg
Other info / logs
This is relevant especially for cases where the user is not able to specify the fname parameter manually to set an absolute path. One example for this mentioned in #33501 are the weights downloaded by tensorflow.keras.applications models. In my case, the user home directory is write-protected on the compute nodes of our HPC cluster and the fallback /tmp also should not be used.
The issue keras-team/keras#11923 set the behavior in keras.