class_docstr: A sequential container that overrides forward to take a mask as well as the usual
  input tensor. This mask is only applied to modules in _MASK_MODULES (which take
  the mask argument).
class_docstr_tok: ["A","sequential","container","that","overrides","forward","to","take","a","mask","as","well","as","the","usual","input","tensor",".","This","mask","is","only","applied","to","modules","in","_MASK_MODULES","(","which","take","the","mask","argument",")","."]
code: def forward(
      self, input: torch.Tensor, mask: torch.Tensor
  ) -> torch.Tensor:
      for module in self:
          if any(
              isinstance(module, mask_type)
              for mask_type in self._MASK_MODULES
          ):
              input = module(input, mask=mask)
          else:
              input = module(input)
  
      return input
  
imports: from typing import List, Optional, Tuple
  import torch
  from pytorchvideo.layers.utils import set_attributes
  from torch import nn
  from torch.nn.utils.rnn import pack_padded_sequence
label_desc: Use image node_id 1 for calling the MaskedSequential obj's underlying member method code with example usage: obj.forward(input, mask) and returns: input