class_docstr: This class tests the crypten.nn package.
class_docstr_tok: ["This","class","tests","the","crypten.nn","package","."]
docstr: Test ModuleDict module
code: def test_module_dict(self) -> None:
      """Test ModuleDict module"""
      module_dict = crypten.nn.ModuleDict()
      self.assertEqual(
          len(module_dict), 0, "ModuleDict initialized incorrect size"
      )
  
      # Test initialization
      module_dict = crypten.nn.ModuleDict(
          {
              "conv2d": crypten.nn.Conv2d(10, 10, 3),
              "pool": crypten.nn.MaxPool2d(3),
          }
      )
      self.assertEqual(
          len(module_dict), 2, "ModuleDict initialized incorrect size"
      )
      self.assertTrue(
          "conv2d" in module_dict.keys(), "ModuleDict init failed"
      )
      self.assertTrue(
          isinstance(module_dict["conv2d"], crypten.nn.Conv2d),
          "ModuleDict init failed",
      )
      self.assertTrue(
          "pool" in module_dict.keys(), "ModuleDict init failed"
      )
      self.assertTrue(
          isinstance(module_dict["pool"], crypten.nn.MaxPool2d),
          "ModuleDict init failed",
      )
  
      # Test setitem
      module_dict["conv1d"] = crypten.nn.Conv1d(5, 5, 3)
      self.assertEqual(len(module_dict), 3, "ModuleDict setitem failed")
      self.assertTrue(
          "conv1d" in module_dict.keys(), "ModuleDict setitem failed"
      )
      self.assertTrue(
          isinstance(module_dict["conv1d"], crypten.nn.Conv1d),
          "ModuleDict setitem failed",
      )
  
      # Test pop
      conv = module_dict.pop("conv2d")
      self.assertTrue(
          isinstance(conv, crypten.nn.Conv2d), "ModuleDict pop failed"
      )
      self.assertEqual(len(module_dict), 2, "ModuleDict pop failed")
      self.assertFalse(
          "conv2d" in module_dict.keys(), "ModuleDict pop failed"
      )
  
      # Test list initialization
      module_dict = crypten.nn.ModuleDict(
          [
              ["relu", crypten.nn.ReLU()],
              ["sigmoid", crypten.nn.Sigmoid()],
          ]
      )
      self.assertEqual(
          len(module_dict), 2, "ModuleDict initialized incorrect size"
      )
      self.assertTrue(
          "relu" in module_dict.keys(), "ModuleDict init failed"
      )
      self.assertTrue(
          isinstance(module_dict["relu"], crypten.nn.ReLU),
          "ModuleDict init failed",
      )
      self.assertTrue(
          "sigmoid" in module_dict.keys(), "ModuleDict init failed"
      )
      self.assertTrue(
          isinstance(module_dict["sigmoid"], crypten.nn.Sigmoid),
          "ModuleDict init failed",
      )
  
      # Test clear
      module_dict.clear()
      self.assertEqual(len(module_dict), 0, "ModuleDict clear failed")
  
imports: import copy
  import itertools
  import logging
  import unittest
  import crypten
  import crypten.communicator
  import torch
  import torch.nn.functional
  from crypten.common.rng import generate_random_ring_element
  from crypten.common.tensor_types import is_float_tensor
  from crypten.config import cfg
  from crypten.encoder import FixedPointEncoder
  from test.multiprocess_test_case import get_random_linear, get_random_test_tensor, MultiProcessTestCase, onehot
label_desc: Use image node_id 25 for calling the TestNN obj's underlying member method code with example usage: obj.test_module_dict() without return types