def check_if_patch_exists(self, videos, video_patches, num_frames):
    """Check that given patch is present in video."""
    for video, video_patch in zip(videos, video_patches):
      total_frames = len(video)
      is_present = []
      for start_ind in range(total_frames - num_frames + 1):
        curr_patch = video[start_ind: start_ind + num_frames]
        is_present.append(np.allclose(curr_patch, video_patch))
      self.assertTrue(np.any(is_present))
Check that given patch is present in video.
tensor2tensor/layers/common_video_test.py