(dataset, training)
return dataset
Pre-processing function that concatenates input and target frames.
Pre-processing function that concatenates input and target frames.
Pre - processing function that concatenates input and target frames .
def bair_robot_pushing_preprocess(dataset, training):
  """Pre-processing function that concatenates input and target frames."""
  del training

  def concat_and_add_mask(features, targets):
    """Concatenate input and output frames to form a language modeling setup."""
    inp = features['inputs']
    concat = tf.concat([inp, targets], axis=0)
    mask = tf.concat([tf.zeros_like(inp), tf.ones_like(targets)], axis=0)
    concat = tf.reshape(concat, (-1,))
    mask = tf.reshape(mask, (-1,))
    concat = tf.cast(concat, tf.int32)
    mask = tf.cast(mask, tf.float32)
    features['inputs'] = features['targets'] = concat
    features['mask'] = mask
    return features, concat

  dataset = dataset.map(concat_and_add_mask)
  return dataset
def bair_robot_pushing_preprocess ( dataset , training ) : del training def concat_and_add_mask ( features , targets ) : """Concatenate input and output frames to form a language modeling setup.""" inp = features [ 'inputs' ] concat = tf . concat ( [ inp , targets ] , axis = 0 ) mask = tf . concat ( [ tf . zeros_like ( inp ) , tf . ones_like ( targets ) ] , axis = 0 ) concat = tf . reshape ( concat , ( - 1 , ) ) mask = tf . reshape ( mask , ( - 1 , ) ) concat = tf . cast ( concat , tf . int32 ) mask = tf . cast ( mask , tf . float32 ) features [ 'inputs' ] = features [ 'targets' ] = concat features [ 'mask' ] = mask return features , concat dataset = dataset . map ( concat_and_add_mask ) return dataset