MCPcopy Create free account
hub / github.com/DanielShalam/BPA / get_criterion_by_method

Function get_criterion_by_method

utils.py:118–128  ·  view source on GitHub ↗

Get loss function based on the method.

(method: str)

Source from the content-addressed store, hash-verified

116
117
118def 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
131def init_wandb(exp_name: str, args):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected