def create_i3d_embedding(videos: tf.Tensor, batch_size: int = 16):
  """Embeds the given videos.

  Args:
    videos: a tensor of shape
      [batch_size, num_frames, height=224, width=224, depth=3].
    batch_size: batch size
  Returns:
    embedding: a tensor of shape [batch_size, embedding_size].
  """

  # Making sure that we import the graph separately for
  # each different input video tensor.
  module_name = 'fvd_kinetics-400_id3_module_' + six.ensure_str(
      videos.name).replace(':', '_')
  assert_ops = [
      tf.Assert(
          tf.reduce_max(videos) <= 1.001,
          ['max value in frame is > 1', videos]),
      tf.Assert(
          tf.reduce_min(videos) >= -1.001,
          ['min value in frame is < -1', videos]),
      tf.assert_equal(
          tf.shape(videos)[0],
          batch_size, ['invalid frame batch size: ',
                       tf.shape(videos)],
          summarize=6),
  ]
  with tf.control_dependencies(assert_ops):
    videos = tf.identity(videos)

  module_scope = '%s_apply_default/' % module_name

  video_batch_size = int(videos.shape[0])
  assert video_batch_size in [batch_size, -1, None], 'Invalid batch size'
  tensor_name = module_scope + 'RGB/inception_i3d/Mean:0'
  if not _is_in_graph(tensor_name):
    i3d_model = hub.Module(_MODULE_SPEC, name=module_name)
    i3d_model(videos)

  tensor_name = module_scope + 'RGB/inception_i3d/Mean:0'
  tensor = tf.get_default_graph().get_tensor_by_name(tensor_name)
  return tensor
Embeds the given videos.

  Args:
    videos: a tensor of shape
      [batch_size, num_frames, height=224, width=224, depth=3].
    batch_size: batch size
  Returns:
    embedding: a tensor of shape [batch_size, embedding_size].
  
videogvt/tools/compute_fvd.py