(info="")
| 18 | |
| 19 | |
| 20 | def print_memory_usage(info=""): |
| 21 | t = torch.cuda.get_device_properties(0).total_memory / 1024 ** 2 |
| 22 | r = torch.cuda.memory_reserved(0) / 1024 ** 2 |
| 23 | a = torch.cuda.memory_allocated(0) / 1024 ** 2 |
| 24 | f = r - a # free inside reserved |
| 25 | print(f"[INFO][{info}] total_memory: {t}, reversed: {r}, allocated: {a}") |
| 26 | |
| 27 | |
| 28 | def torch2np(tensor: torch.Tensor, np_data_type: typing.Optional[np.dtype] = None): |
nothing calls this directly
no outgoing calls
no test coverage detected