code: def score_candidate(self, text_vecs, context_len):
      # Encode contexts first
      num_cand = text_vecs.size(1)
      text_vecs = text_vecs.view(-1, text_vecs.size(-1))
      token_idx_ctxt, segment_idx_ctxt, mask_ctxt = to_bert_input(
          text_vecs,
          self.NULL_IDX,
          context_len,
      )
      embedding_ctxt = self.model(
          token_idx_ctxt,
          segment_idx_ctxt,
          mask_ctxt,
      )
  
      return embedding_ctxt.view(-1, num_cand)
  
imports: import os
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from collections import OrderedDict
  from tqdm import tqdm
  from pytorch_transformers.modeling_utils import CONFIG_NAME, WEIGHTS_NAME
  from pytorch_transformers.modeling_bert import BertPreTrainedModel, BertConfig, BertModel
  from pytorch_transformers.modeling_roberta import RobertaConfig, RobertaModel
  from pytorch_transformers.tokenization_bert import BertTokenizer
  from pytorch_transformers.tokenization_roberta import RobertaTokenizer
  from blink.common.ranker_base import BertEncoder, get_model_obj
  from blink.common.optimizer import get_bert_optimizer
  from blink.common.params import ENT_START_TAG, ENT_END_TAG, ENT_TITLE_TAG
label_desc: Use image node_id 7 for calling the CrossEncoderRanker obj's underlying member method code with example usage: obj.score_candidate(text_vecs, context_len) and returns: embedding_ctxt