(prefix, device)
| 34 | |
| 35 | # display the peak memory of cuda |
| 36 | def print_peak_memory(prefix, device): |
| 37 | if device == 0: |
| 38 | print(f"{prefix}: {torch.cuda.max_memory_allocated(device) // 1e6}MB ") |
| 39 | |
| 40 | def anal_tensor(tensor, name): |
| 41 | sent = f" name: {name} mean: {tensor.mean().item()} std: {tensor.std().item()} min: {tensor.min().item()} max: {tensor.max().item()}" |