runtime-modeling/model_def.py
def call(self, inputs, training=True):
    """Implementation of MnasBlock call().

    Args:
      inputs: the inputs tensor.
      training: boolean, whether the model is constructed for training.

    Returns:
      A output tensor.
    """
    tf.logging.info('Block input: %s shape: %s' % (inputs.name, inputs.shape))
    if self._block_args.expand_ratio != 1:
      x = tf.nn.relu(self._bn0(self._expand_conv(inputs), training=training))
    else:
      x = inputs
    tf.logging.info('Expand: %s shape: %s' % (x.name, x.shape))

    x = tf.nn.relu(self._bn1(self._depthwise_conv(x), training=training))
    tf.logging.info('DWConv: %s shape: %s' % (x.name, x.shape))

    if self.has_se:
      with tf.variable_scope('se'):
        x = self._call_se(x)

    self.endpoints = {'expansion_output': x}

    x = self._bn2(self._project_conv(x), training=training)
    if self._block_args.id_skip:
      if all(
          s == 1 for s in self._block_args.strides
      ) and self._block_args.input_filters == self._block_args.output_filters:
        x = tf.add(x, inputs)
    tf.logging.info('Project: %s shape: %s' % (x.name, x.shape))
    return x
Implementation of MnasBlock call().

    Args:
      inputs: the inputs tensor.
      training: boolean, whether the model is constructed for training.

    Returns:
      A output tensor.
    
Implementation of MnasBlock call().
Implementation of MnasBlock call () .
def call(self, inputs, training=True):
    tf.logging.info('Block input: %s shape: %s' % (inputs.name, inputs.shape))
    if self._block_args.expand_ratio != 1:
      x = tf.nn.relu(self._bn0(self._expand_conv(inputs), training=training))
    else:
      x = inputs
    tf.logging.info('Expand: %s shape: %s' % (x.name, x.shape))
    x = tf.nn.relu(self._bn1(self._depthwise_conv(x), training=training))
    tf.logging.info('DWConv: %s shape: %s' % (x.name, x.shape))
    if self.has_se:
      with tf.variable_scope('se'):
        x = self._call_se(x)
    self.endpoints = {'expansion_output': x}
    x = self._bn2(self._project_conv(x), training=training)
    if self._block_args.id_skip:
      if all(
          s == 1 for s in self._block_args.strides
      ) and self._block_args.input_filters == self._block_args.output_filters:
        x = tf.add(x, inputs)
    tf.logging.info('Project: %s shape: %s' % (x.name, x.shape))
    return x
def call ( self , inputs , training = True ) : tf . logging . info ( 'Block input: %s shape: %s' % ( inputs . name , inputs . shape ) ) if self . _block_args . expand_ratio != 1 : x = tf . nn . relu ( self . _bn0 ( self . _expand_conv ( inputs ) , training = training ) ) else : x = inputs tf . logging . info ( 'Expand: %s shape: %s' % ( x . name , x . shape ) ) x = tf . nn . relu ( self . _bn1 ( self . _depthwise_conv ( x ) , training = training ) ) tf . logging . info ( 'DWConv: %s shape: %s' % ( x . name , x . shape ) ) if self . has_se : with tf . variable_scope ( 'se' ) : x = self . _call_se ( x ) self . endpoints = { 'expansion_output' : x } x = self . _bn2 ( self . _project_conv ( x ) , training = training ) if self . _block_args . id_skip : if all ( s == 1 for s in self . _block_args . strides ) and self . _block_args . input_filters == self . _block_args . output_filters : x = tf . add ( x , inputs ) tf . logging . info ( 'Project: %s shape: %s' % ( x . name , x . shape ) ) return x
Implementation of MnasBlock call().
Implementation of MnasBlock call () .
"""Implementation of MnasBlock call().

    Args:
      inputs: the inputs tensor.
      training: boolean, whether the model is constructed for training.

    Returns:
      A output tensor.
    """
A output tensor.
A output tensor .
self
inputs
the inputs tensor.
the inputs tensor .
training
boolean, whether the model is constructed for training.
boolean whether the model is constructed for training .