def video_l1_top(body_output, targets, model_hparams, vocab_size):
  """Top transformation for video."""
  del targets, vocab_size  # unused arg
  num_channels = model_hparams.problem.num_channels
  num_frames = model_hparams.video_num_target_frames
  with tf.variable_scope("rgb"):
    body_output_shape = common_layers.shape_list(body_output)
    res = tf.layers.dense(body_output, num_channels * num_frames, name="cast")
    res = tf.reshape(res, body_output_shape[:3] + [num_channels, num_frames])
    res = tf.transpose(res, [0, 4, 1, 2, 3])  # Move frames next to batch.
    if not tf.get_variable_scope().reuse:
      res_argmax = res[:, -1, :, :, :]
      tf.summary.image(
          "result",
          common_layers.tpu_safe_image_summary(res_argmax),
          max_outputs=1)
    return tf.expand_dims(res, axis=-1)
def video_l1_top ( body_output , targets , model_hparams , vocab_size ) : del targets , vocab_size num_channels = model_hparams . problem . num_channels num_frames = model_hparams . video_num_target_frames with tf . variable_scope ( "rgb" ) : body_output_shape = common_layers . shape_list ( body_output ) res = tf . layers . dense ( body_output , num_channels * num_frames , name = "cast" ) res = tf . reshape ( res , body_output_shape [ : 3 ] + [ num_channels , num_frames ] ) res = tf . transpose ( res , [ 0 , 4 , 1 , 2 , 3 ] ) if not tf . get_variable_scope ( ) . reuse : res_argmax = res [ : , - 1 , : , : , : ] tf . summary . image ( "result" , common_layers . tpu_safe_image_summary ( res_argmax ) , max_outputs = 1 ) return tf . expand_dims ( res , axis = - 1 )
Top transformation for video.