docstr: Filter all mentions > maximum mention length
  mention_scores: torch.FloatTensor (bsz, num_mentions)
  mention_bounds: torch.LongTensor (bsz, num_mentions, 2)
docstr_tok: ["Filter","all","mentions",">","maximum","mention","length","mention_scores",":","torch.FloatTensor","(","bsz",",","num_mentions",")","mention_bounds",":","torch.LongTensor","(","bsz",",","num_mentions",",","2",")"]
code: def filter_by_mention_size(
      self, mention_scores, mention_bounds, max_mention_length
  ):
      """
      Filter all mentions > maximum mention length
      mention_scores: torch.FloatTensor (bsz, num_mentions)
      mention_bounds: torch.LongTensor (bsz, num_mentions, 2)
      """
      # (bsz, num_mentions)
      mention_bounds_mask = (
          mention_bounds[:, :, 1] - mention_bounds[:, :, 0]
          <= max_mention_length
      )
      # (bsz, num_filtered_mentions)
      mention_scores = mention_scores[mention_bounds_mask]
      mention_scores = mention_scores.view(
          mention_bounds_mask.size(0), -1
      )
      # (bsz, num_filtered_mentions, 2)
      mention_bounds = mention_bounds[mention_bounds_mask]
      mention_bounds = mention_bounds.view(
          mention_bounds_mask.size(0), -1, 2
      )
      return mention_scores, mention_bounds
  
imports: import os
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from tqdm import tqdm
  from collections import OrderedDict
  from pytorch_transformers.modeling_bert import BertPreTrainedModel, BertConfig, BertModel
  from pytorch_transformers.tokenization_bert import BertTokenizer
  from elq.common.ranker_base import BertEncoder, get_model_obj
  from blink.common.optimizer import get_bert_optimizer
  from elq.biencoder.allennlp_span_utils import batched_span_select, batched_index_select
  from elq.biencoder.utils import batch_reshape_mask_left
label_desc: Use image node_id 3 for calling the MentionScoresHead obj's underlying member method code with example usage: obj.filter_by_mention_size(mention_scores, mention_bounds, max_mention_length) and returns: mention_scores,  mention_bounds