(config)
return _loss_fn
get loss object from register
get loss object from register
get loss object from register
def losses(config):
  ''' get loss object from register '''
  if 'distilling' in config['solver'] and config['solver']['distilling'][
      'enable']:
    loss_name = config['solver']['distilling']['loss']
  else:
    loss_name = config['solver']['optimizer']['loss']
  if isinstance(loss_name, list):
    _loss_fn = []
    for one_loss_name in loss_name:
      logging.info('loss == {}'.format(one_loss_name))
      _loss_fn.append(registers.loss[one_loss_name](config))
  else:
    logging.info('loss == {}'.format(loss_name))
    _loss_fn = registers.loss[loss_name](config)
  return _loss_fn
def losses ( config ) : if 'distilling' in config [ 'solver' ] and config [ 'solver' ] [ 'distilling' ] [ 'enable' ] : loss_name = config [ 'solver' ] [ 'distilling' ] [ 'loss' ] else : loss_name = config [ 'solver' ] [ 'optimizer' ] [ 'loss' ] if isinstance ( loss_name , list ) : _loss_fn = [ ] for one_loss_name in loss_name : logging . info ( 'loss == {}' . format ( one_loss_name ) ) _loss_fn . append ( registers . loss [ one_loss_name ] ( config ) ) else : logging . info ( 'loss == {}' . format ( loss_name ) ) _loss_fn = registers . loss [ loss_name ] ( config ) return _loss_fn