Output:
Here is a Python function that transforms bytes to Giga bytes:\n\npython\ndef bytes_to_giga_bytes(bytes):\n    return bytes / 1024 / 1024 / 1024\n\n\nThis function takes a single
Nice, we can now directly use the result to convert bytes into Gigabytes.
python
def bytes_to_giga_bytes(bytes):
  return bytes / 1024 / 1024 / 1024
Let's call torch.cuda.max_memory_allocated to measure the peak GPU memory allocation.
python
bytes_to_giga_bytes(torch.cuda.max_memory_allocated())
Output: