(self, config, mode, train_inception=False)
Basic setup.

    Args:
      config: Object containing configuration parameters.
      mode: "train", "eval" or "inference".
      train_inception: Whether the inception submodel variables are trainable.
Basic setup.
Basic setup .
def __init__(self, config, mode, train_inception=False):
    """Basic setup.

    Args:
      config: Object containing configuration parameters.
      mode: "train", "eval" or "inference".
      train_inception: Whether the inception submodel variables are trainable.
    """
    assert mode in ["train", "eval", "inference"]
    self.config = config
    self.mode = mode
    self.train_inception = train_inception

    # Reader for the input data.
    self.reader = tf.TFRecordReader()

    # To match the "Show and Tell" paper we initialize all variables with a
    # random uniform initializer.
    self.initializer = tf.random_uniform_initializer(
        minval=-self.config.initializer_scale,
        maxval=self.config.initializer_scale)

    # A float32 Tensor with shape [batch_size, height, width, channels].
    self.images = None

    # An int32 Tensor with shape [batch_size, padded_length].
    self.input_seqs = None

    # An int32 Tensor with shape [batch_size, padded_length].
    self.target_seqs = None

    # An int32 0/1 Tensor with shape [batch_size, padded_length].
    self.input_mask = None

    # A float32 Tensor with shape [batch_size, embedding_size].
    self.image_embeddings = None

    # A float32 Tensor with shape [batch_size, padded_length, embedding_size].
    self.seq_embeddings = None

    # A float32 scalar Tensor; the total loss for the trainer to optimize.
    self.total_loss = None

    # A float32 Tensor with shape [batch_size * padded_length].
    self.target_cross_entropy_losses = None

    # A float32 Tensor with shape [batch_size * padded_length].
    self.target_cross_entropy_loss_weights = None

    # Collection of variables from the inception submodel.
    self.inception_variables = []

    # Function to restore the inception submodel from checkpoint.
    self.init_fn = None

    # Global step Tensor.
    self.global_step = None
def __init__ ( self , config , mode , train_inception = False ) : assert mode in [ "train" , "eval" , "inference" ] self . config = config self . mode = mode self . train_inception = train_inception # Reader for the input data. self . reader = tf . TFRecordReader ( ) # To match the "Show and Tell" paper we initialize all variables with a # random uniform initializer. self . initializer = tf . random_uniform_initializer ( minval = - self . config . initializer_scale , maxval = self . config . initializer_scale ) # A float32 Tensor with shape [batch_size, height, width, channels]. self . images = None # An int32 Tensor with shape [batch_size, padded_length]. self . input_seqs = None # An int32 Tensor with shape [batch_size, padded_length]. self . target_seqs = None # An int32 0/1 Tensor with shape [batch_size, padded_length]. self . input_mask = None # A float32 Tensor with shape [batch_size, embedding_size]. self . image_embeddings = None # A float32 Tensor with shape [batch_size, padded_length, embedding_size]. self . seq_embeddings = None # A float32 scalar Tensor; the total loss for the trainer to optimize. self . total_loss = None # A float32 Tensor with shape [batch_size * padded_length]. self . target_cross_entropy_losses = None # A float32 Tensor with shape [batch_size * padded_length]. self . target_cross_entropy_loss_weights = None # Collection of variables from the inception submodel. self . inception_variables = [ ] # Function to restore the inception submodel from checkpoint. self . init_fn = None # Global step Tensor. self . global_step = None