class_docstr: A class implements tf.keras.Model for MNAS-like model.
  
  Reference: https://arxiv.org/abs/1807.11626
class_docstr_tok: ["A","class","implements","tf.keras.Model","for","MNAS-like","model",".","Reference",":","https",":","\/\/arxiv.org\/abs\/1807.11626"]
docstr: Implementation of call().
  
  Args:
    inputs: input tensors.
    training: boolean, whether the model is constructed for training.
    features_only: build the base feature network only.
    pooled_features_only: build the base network for features extraction
      (after 1x1 conv layer and global pooling, but before dropout and fc
      head).
  
  Returns:
    output tensors.
docstr_tok: ["Implementation","of","call","(",")",".","Args",":","inputs",":","input","tensors",".","training",":","boolean",",","whether","the","model","is","constructed","for","training",".","features_only",":","build","the","base","feature","network","only",".","pooled_features_only",":","build","the","base","network","for","features","extraction","(","after","1x1","conv","layer","and","global","pooling",",","but","before","dropout","and","fc","head",")",".","Returns",":","output","tensors","."]
code: def call(
      self,
      inputs,
      training=True,
      features_only=None,
      pooled_features_only=False,
  ):
      """Implementation of call().
  
      Args:
        inputs: input tensors.
        training: boolean, whether the model is constructed for training.
        features_only: build the base feature network only.
        pooled_features_only: build the base network for features extraction
          (after 1x1 conv layer and global pooling, but before dropout and fc
          head).
  
      Returns:
        output tensors.
      """
      outputs = None
      self.endpoints = {}
      reduction_idx = 0
      # Calls Stem layers
      with tf.variable_scope("stem"):
          outputs = self._relu_fn(
              self._bn0(self._conv_stem(inputs), training=training)
          )
      logging.info(
          "Built stem layers with output shape: %s", outputs.shape
      )
      self.endpoints["stem"] = outputs
  
      # Calls blocks.
      for idx, block in enumerate(self._blocks):
          is_reduction = (
              False  # reduction flag for blocks after the stem layer
          )
          # If the first block has super-pixel (space-to-depth) layer, then stem is
          # the first reduction point.
          if block.block_args().super_pixel == 1 and idx == 0:
              reduction_idx += 1
              self.endpoints["reduction_%s" % reduction_idx] = outputs
  
          elif (idx == len(self._blocks) - 1) or self._blocks[
              idx + 1
          ].block_args().strides[0] > 1:
              is_reduction = True
              reduction_idx += 1
  
          with tf.variable_scope("blocks_%s" % idx):
              survival_prob = self._global_params.survival_prob
              if survival_prob:
                  drop_rate = 1.0 - survival_prob
                  survival_prob = 1.0 - drop_rate * float(idx) / len(
                      self._blocks
                  )
                  logging.info(
                      "block_%s survival_prob: %s", idx, survival_prob
                  )
              outputs = block.call(
                  outputs,
                  training=training,
                  survival_prob=survival_prob,
              )
              self.endpoints["block_%s" % idx] = outputs
              if is_reduction:
                  self.endpoints[
                      "reduction_%s" % reduction_idx
                  ] = outputs
              if block.endpoints:
                  for k, v in six.iteritems(block.endpoints):
                      self.endpoints["block_%s/%s" % (idx, k)] = v
                      if is_reduction:
                          self.endpoints[
                              "reduction_%s/%s" % (reduction_idx, k)
                          ] = v
      self.endpoints["features"] = outputs
  
      if not features_only:
          # Calls final layers and returns logits.
          with tf.variable_scope("head"):
              outputs = self._relu_fn(
                  self._bn1(self._conv_head(outputs), training=training)
              )
              self.endpoints["head_1x1"] = outputs
  
              if self._global_params.local_pooling:
                  shape = outputs.get_shape().as_list()
                  kernel_size = [
                      1,
                      shape[self._spatial_dims[0]],
                      shape[self._spatial_dims[1]],
                      1,
                  ]
                  outputs = tf.nn.avg_pool(
                      outputs,
                      ksize=kernel_size,
                      strides=[1, 1, 1, 1],
                      padding="VALID",
                  )
                  self.endpoints["pooled_features"] = outputs
                  if not pooled_features_only:
                      if self._dropout:
                          outputs = self._dropout(
                              outputs, training=training
                          )
                      self.endpoints["global_pool"] = outputs
                      if self._fc:
                          outputs = tf.squeeze(
                              outputs, self._spatial_dims
                          )
                          outputs = self._fc(outputs)
                      self.endpoints["head"] = outputs
              else:
                  outputs = self._avg_pooling(outputs)
                  self.endpoints["pooled_features"] = outputs
                  if not pooled_features_only:
                      if self._dropout:
                          outputs = self._dropout(
                              outputs, training=training
                          )
                      self.endpoints["global_pool"] = outputs
                      if self._fc:
                          outputs = self._fc(outputs)
                      self.endpoints["head"] = outputs
      return outputs
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import functools
  import math
  from absl import logging
  import numpy
  import six
  from six.moves import xrange
  import tensorflow.compat.v1
  import utils
label_desc: Use image node_id 4 for calling the Model obj's underlying member method code with example usage: obj.call(inputs, training, features_only, pooled_features_only) and returns: outputs