Usage: Calculate Params and FLOPs via [THOP](https://github.com/Lyken17/pytorch-OpCounter) Necessarity: from thop import profile from thop import clever_format :param model: :param input_tensor: :return:
(model, input_tensor)
| 69 | return torch.mean(torch.stack(self.losses[np.maximum(len(self.losses)-self.num, 0):])) |
| 70 | |
| 71 | def CalParams(model, input_tensor): |
| 72 | """ |
| 73 | Usage: |
| 74 | Calculate Params and FLOPs via [THOP](https://github.com/Lyken17/pytorch-OpCounter) |
| 75 | Necessarity: |
| 76 | from thop import profile |
| 77 | from thop import clever_format |
| 78 | :param model: |
| 79 | :param input_tensor: |
| 80 | :return: |
| 81 | """ |
| 82 | flops, params = profile(model, inputs=(input_tensor,)) |
| 83 | flops, params = clever_format([flops, params], "%.3f") |
| 84 | print('[Statistics Information]\nFLOPs: {}\nParams: {}'.format(flops, params)) |
| 85 | |
| 86 | def one_hot_encoder(input_tensor,dataset,n_classes = None): |
| 87 | tensor_list = [] |
nothing calls this directly
no outgoing calls
no test coverage detected