nas-search/supernet_macro.py
def build_supernet(images, model_name, training, override_params=None, dropout_rate=None):
  """A helper function to creates the NAS Supernet and returns predicted logits.

  Args:
    images: input images tensor.
    model_name: string, the model name
    training: boolean, whether the model is constructed for training.
    override_params: A dictionary of params for overriding. Fields must exist in
      singlepath_supernet.GlobalParams.

  Returns:
    logits: the logits tensor of classes.
    runtime: the total runtime based on the threshold decisions
    endpoints: the endpoints for each layer.
  Raises:
    When model_name specified an undefined model, raises NotImplementedError.
    When override_params has invalid fields, raises ValueError.
  """
  assert isinstance(images, tf.Tensor)
  if model_name == 'single-path-search':
    blocks_args, global_params = single_path_search()
  else:
    raise NotImplementedError('model name is not pre-defined: %s' % model_name)

  if override_params:
    # ValueError will be raised here if override_params has fields not included
    # in global_params.
    global_params = global_params._replace(**override_params)

  with tf.variable_scope(model_name):
    model = singlepath_supernet.SinglePathSuperNet(blocks_args, global_params, dropout_rate)
    logits, total_runtime = model(images, training=training)

  logits = tf.identity(logits, 'logits')
  return logits, total_runtime, model.indicators
A helper function to creates the NAS Supernet and returns predicted logits.

  Args:
    images: input images tensor.
    model_name: string, the model name
    training: boolean, whether the model is constructed for training.
    override_params: A dictionary of params for overriding. Fields must exist in
      singlepath_supernet.GlobalParams.

  Returns:
    logits: the logits tensor of classes.
    runtime: the total runtime based on the threshold decisions
    endpoints: the endpoints for each layer.
  Raises:
    When model_name specified an undefined model, raises NotImplementedError.
    When override_params has invalid fields, raises ValueError.
  
A helper function to creates the NAS Supernet and returns predicted logits.
Args:
images: input images tensor.
model_name: string, the model name
training: boolean, whether the model is constructed for training.
override_params: A dictionary of params for overriding.

the logits tensor of classes.
runtime: the total runtime based on the threshold decisions
endpoints: the endpoints for each layer.
Raises:
When model_name specified an undefined model, raises NotImplementedError.
When override_params has invalid fields, raises ValueError.
A helper function to creates the NAS Supernet and returns predicted logits . Args : images : input images tensor . model_name : string the model name training : boolean whether the model is constructed for training . override_params : A dictionary of params for overriding . the logits tensor of classes . runtime : the total runtime based on the threshold decisions endpoints : the endpoints for each layer . Raises : When model_name specified an undefined model raises NotImplementedError . When override_params has invalid fields raises ValueError .
def build_supernet(images, model_name, training, override_params=None, dropout_rate=None):
  assert isinstance(images, tf.Tensor)
  if model_name == 'single-path-search':
    blocks_args, global_params = single_path_search()
  else:
    raise NotImplementedError('model name is not pre-defined: %s' % model_name)
  if override_params:
    global_params = global_params._replace(**override_params)
  with tf.variable_scope(model_name):
    model = singlepath_supernet.SinglePathSuperNet(blocks_args, global_params, dropout_rate)
    logits, total_runtime = model(images, training=training)
  logits = tf.identity(logits, 'logits')
  return logits, total_runtime, model.indicators
def build_supernet ( images , model_name , training , override_params = None , dropout_rate = None ) : assert isinstance ( images , tf . Tensor ) if model_name == 'single-path-search' : blocks_args , global_params = single_path_search ( ) else : raise NotImplementedError ( 'model name is not pre-defined: %s' % model_name ) if override_params : global_params = global_params . _replace ( ** override_params ) with tf . variable_scope ( model_name ) : model = singlepath_supernet . SinglePathSuperNet ( blocks_args , global_params , dropout_rate ) logits , total_runtime = model ( images , training = training ) logits = tf . identity ( logits , 'logits' ) return logits , total_runtime , model . indicators
A helper function to creates the NAS Supernet and returns predicted logits.
A helper function to creates the NAS Supernet and returns predicted logits .
"""A helper function to creates the NAS Supernet and returns predicted logits.

  Args:
    images: input images tensor.
    model_name: string, the model name
    training: boolean, whether the model is constructed for training.
    override_params: A dictionary of params for overriding. Fields must exist in
      singlepath_supernet.GlobalParams.

  Returns:
    logits: the logits tensor of classes.
    runtime: the total runtime based on the threshold decisions
    endpoints: the endpoints for each layer.
  Raises:
    When model_name specified an undefined model, raises NotImplementedError.
    When override_params has invalid fields, raises ValueError.
  """ # ValueError will be raised here if override_params has fields not included # in global_params.
images
model_name
training
override_params
dropout_rate