code: def test_learn_masked_default(self):
      feature_dim = 8
      seq_len = 10
      fake_input = torch.rand([4, feature_dim])
  
      # All valid mask
      all_valid_mask = _lengths2mask(
          torch.tensor([seq_len, seq_len, seq_len, seq_len]),
          fake_input.shape[1],
      )
      model = LearnMaskedDefault(feature_dim)
      output = model(fake_input, mask=all_valid_mask)
      self.assertTrue(output.equal(fake_input))
  
      # No valid mask
      no_valid_mask = _lengths2mask(
          torch.tensor([0, 0, 0, 0]), fake_input.shape[1]
      )
      model = LearnMaskedDefault(feature_dim)
      output = model(fake_input, mask=no_valid_mask)
      self.assertTrue(
          output.equal(model._learned_defaults.repeat(4, 1))
      )
  
      # Half valid mask
      half_valid_mask = _lengths2mask(
          torch.tensor([1, 1, 0, 0]), fake_input.shape[1]
      )
      model = LearnMaskedDefault(feature_dim)
      output = model(fake_input, mask=half_valid_mask)
      self.assertTrue(output[:2].equal(fake_input[:2]))
      self.assertTrue(
          output[2:].equal(model._learned_defaults.repeat(2, 1))
      )
  
file_path: pytorchvideo/tests/test_models_masked_multistream.py
imports: import copy
  import unittest
  import torch
  import torch.nn
  from pytorchvideo.layers import make_multilayer_perceptron, PositionalEncoding
  from pytorchvideo.models.masked_multistream import LearnMaskedDefault, LSTM, MaskedSequential, MaskedTemporalPooling, TransposeMultiheadAttention, TransposeTransformerEncoder
label_desc: Use image node_id 7 for calling the TestMaskedMultiStream obj's underlying member method code with example usage: obj.test_learn_masked_default() without return types