(self, a)
| 133 | return plt |
| 134 | |
| 135 | def to_numpy(self, a): |
| 136 | if isinstance(a, list): |
| 137 | return np.array(a) |
| 138 | for kind in [torch.Tensor, torch.nn.Parameter]: |
| 139 | if isinstance(a, kind): |
| 140 | if hasattr(a, 'detach'): |
| 141 | a = a.detach() |
| 142 | return a.cpu().numpy() |
| 143 | return a |
| 144 | |
| 145 | def add_scalar(self, tag, data): |
| 146 | data = self.to_numpy(data) |