code: def compute_masked_hidden(hidden: Tensor, mask: Tensor) -> Tensor:
      """Get only the masked region.
  
      hidden: tensor, dim (bs, num_feat, feat_dim)
      mask: bool tensor, dim (bs, num_feat)
      Returns a tensor of dim (bs * num_feat_unmasked, feat_dim),
      containing the features in hidden that are True in the mask tensor.
      """
      mask = mask.unsqueeze(-1).expand_as(hidden)
      hidden_masked = (
          hidden[mask].contiguous().view(-1, hidden.size(-1))
      )
      return hidden_masked
  
file_path: mmf/mmf/models/transformers/heads/utils.py
imports: import collections
  import collections.abc
  from typing import Dict, List, Optional, Union
  from mmf.common.registry import registry
  from torch import nn, Tensor
label_desc: Use image node_id 2 for calling a global function with example usage: compute_masked_hidden(hidden, mask) and returns: hidden_masked