(level_returns)
return new_level_returns
Converts training level names to test level names.
Converts training level names to test level names.
Converts training level names to test level names .
def _transform_level_returns(level_returns):
  """Converts training level names to test level names."""
  new_level_returns = {}
  for level_name, returns in level_returns.iteritems():
    new_level_returns[LEVEL_MAPPING.get(level_name, level_name)] = returns

  test_set = set(LEVEL_MAPPING.values())
  diff = test_set - set(new_level_returns.keys())
  if diff:
    raise ValueError('Missing levels: %s' % list(diff))

  for level_name, returns in new_level_returns.iteritems():
    if level_name in test_set:
      if not returns:
        raise ValueError('Missing returns for level: \'%s\': ' % level_name)
    else:
      tf.logging.info('Skipping level %s for calculation.', level_name)

  return new_level_returns
def _transform_level_returns ( level_returns ) : new_level_returns = { } for level_name , returns in level_returns . iteritems ( ) : new_level_returns [ LEVEL_MAPPING . get ( level_name , level_name ) ] = returns test_set = set ( LEVEL_MAPPING . values ( ) ) diff = test_set - set ( new_level_returns . keys ( ) ) if diff : raise ValueError ( 'Missing levels: %s' % list ( diff ) ) for level_name , returns in new_level_returns . iteritems ( ) : if level_name in test_set : if not returns : raise ValueError ( 'Missing returns for level: \'%s\': ' % level_name ) else : tf . logging . info ( 'Skipping level %s for calculation.' , level_name ) return new_level_returns