code: def _test_forward(self, device, batch_size=8, seed=0):
      torch.manual_seed(seed)
      vit = self._vit()
      encoder = MAEEncoder.from_vit_encoder(vit.encoder).to(device)
      tokens = torch.rand(
          batch_size, vit.seq_length, vit.hidden_dim
      ).to(device)
      _idx_keep, _ = utils.random_token_mask(
          size=(batch_size, vit.seq_length),
          device=device,
      )
      for idx_keep in [None, _idx_keep]:
          with self.subTest(idx_keep=idx_keep):
              out = encoder(tokens, idx_keep)
  
              # output shape must be correct
              expected_shape = list(tokens.shape)
              if idx_keep is not None:
                  expected_shape[1] = idx_keep.shape[1]
              self.assertListEqual(list(out.shape), expected_shape)
  
              # output must have reasonable numbers
              self.assertTrue(
                  torch.all(torch.not_equal(out, torch.inf))
              )
  
imports: import unittest
  import torch
  import torchvision
  from lightly import _torchvision_vit_available
  from lightly.models import utils
label_desc: Use image node_id 3 for calling the TestMAEEncoder obj's underlying member method code with example usage: obj._test_forward(device, batch_size, seed) without return types