Get loss function based on the method.
(method: str)
| 116 | |
| 117 | |
| 118 | def get_criterion_by_method(method: str): |
| 119 | """ |
| 120 | Get loss function based on the method. |
| 121 | """ |
| 122 | |
| 123 | if 'pt_map' in method: |
| 124 | return torch.nn.NLLLoss() |
| 125 | elif 'proto' in method: |
| 126 | return torch.nn.CrossEntropyLoss() |
| 127 | else: |
| 128 | raise ValueError(f'Not implemented criterion for this method. available methods are: {list(METHODS.keys())}') |
| 129 | |
| 130 | |
| 131 | def init_wandb(exp_name: str, args): |
nothing calls this directly
no outgoing calls
no test coverage detected