class_docstr: reference: https://github.com/LisaAnne/LocalizingMoments/blob/master/utils/eval.py
  https://github.com/LisaAnne/LocalizingMoments/blob/master/utils/data_processing.py
class_docstr_tok: ["reference",":","https",":","\/\/github.com\/LisaAnne\/LocalizingMoments\/blob\/master\/utils\/eval.py","https",":","\/\/github.com\/LisaAnne\/LocalizingMoments\/blob\/master\/utils\/data_processing.py"]
code: def __call__(self, sample):
      # TODO: make an index select from self.possible_segments.
      hidden_video = sample["hidden_video"]
      pooled_text = sample["pooled_text"]
      vmasks = sample["vmasks"]
      # probably maintain valid results here.
  
      hidden_video = hidden_video[:, 1:-1, :]
      # probably maintain valid results here.
      pooled_video = []
      for s, e in self.possible_segments:
          pooled_video.append(
              torch.mean(
                  hidden_video[:, int(s * 5) : int((e + 1) * 5), :],
                  dim=1,
                  keepdim=True,
              )
          )
      pooled_video = torch.cat(pooled_video, dim=1)
      scores = (
          torch.bmm(pooled_video, pooled_text.unsqueeze(-1))
          .squeeze(-1)
          .cpu()
      )
  
      ranks = scores.argsort(dim=-1, descending=True)
  
      for batch_idx, rank in enumerate(ranks):
          rank_of_moment = []
          for m_idx, moment in enumerate(rank):
              s, e = self.possible_segments[moment.item()]
              if torch.any(
                  vmasks[batch_idx, int(s * 5) : int((e + 1) * 5)]
              ):
                  rank_of_moment.append((s, e))
          self.full_scores.append(rank_of_moment)
  
imports: import os
  import random
  import json
  import numpy
  import torch
  import pickle
  import math
  from tqdm import tqdm
label_desc: Use image node_id 3 for calling the DiDeMoPredictor obj's underlying member method code with example usage: obj.__call__(sample) without return types