def psnr_and_ssim(output, target):
  """Compute the PSNR and SSIM.

  Args:
    output: 4-D Tensor, shape=(num_frames, height, width, num_channels)
    target: 4-D Tensor, shape=(num_frames, height, width, num_channels)
  Returns:
    psnr: 1-D Tensor, shape=(num_frames,)
    ssim: 1-D Tensor, shape=(num_frames,)
  """
  output = tf.cast(output, dtype=tf.int32)
  target = tf.cast(target, dtype=tf.int32)
  psnr = tf.image.psnr(output, target, max_val=255)
  ssim = tf.image.ssim(output, target, max_val=255)
  return psnr, ssim
Compute the PSNR and SSIM.

  Args:
    output: 4-D Tensor, shape=(num_frames, height, width, num_channels)
    target: 4-D Tensor, shape=(num_frames, height, width, num_channels)
  Returns:
    psnr: 1-D Tensor, shape=(num_frames,)
    ssim: 1-D Tensor, shape=(num_frames,)
  
tensor2tensor/utils/video_metrics.py