Once Model Trained Does Not Empty The GPU Space, it uses  so much of much GPU Space. Using M1 Pro. Installed the tensorflow using the  TensorFlow Plugin Metal Developers
@NiharJani2002 Could you use tf.memory.total_allocated_memory() to check the total amount of GPU memory allocated by your TensorFlow session. Please ensure you're using the latest versions of TensorFlow and tensorflow-metal plugin as they might have included memory optimization updates. Kindly check for known issues and workarounds related to memory usage on the Apple Developer Forum (https://developer.apple.com/metal/tensorflow-plugin/).
In order to expedite the trouble-shooting process, please provide a complete code snippet to reproduce the issue reported here.
Thank you!
 The issue has been solved. I have seen blogs to solve it @NiharJani2002 Thank you for the confirmation!
Could you please move this issue to closed status if it is resolved?
Thank you! Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62773">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62773">No</a>

### Issue type

Performance

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

source

### TensorFlow version

2.15.0

### Custom code

Yes

### OS platform and distribution

Mac OS Sononoma 14.2 and M1 Pro 

### Mobile device

_No response_

### Python version

3.9.18

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

Utilises The Entire Gpu and does not empty when the model is completely trained. If I again train the model, it just add up the space in my gpu.

### Standalone code to reproduce the issue

```shell
Training Dataset of Brain Tumour segmentation .nii files, convert it into numpy and train unet on it. Size of Unet 4 encoder and 4 decoder.
```


### Relevant log output

```shell
Suggestion Given By The Mac to close the code, occupies most of the spaces In RAM. 
RAM - 16gb
```
