class_docstr: This class tests all member functions of crypten package
class_docstr_tok: ["This","class","tests","all","member","functions","of","crypten","package"]
docstr: Tests the registration mechanism for custom `CrypTensor` types.
code: def test_cryptensor_registration(self):
      """Tests the registration mechanism for custom `CrypTensor` types."""
  
      # perform tests:
      cryptensor_name = "my_cryptensor"
      self.assertEqual(crypten.get_default_cryptensor_type(), "mpc")
      with self.assertRaises(ValueError):
          crypten.set_default_cryptensor_type(cryptensor_name)
      tensor = crypten.cryptensor(torch.zeros(1, 3))
      self.assertEqual(crypten.get_cryptensor_type(tensor), "mpc")
  
      # register new tensor type:
      @crypten.register_cryptensor(cryptensor_name)
      class MyCrypTensor(crypten.CrypTensor):
          """Dummy `CrypTensor` type."""
  
          def __init__(self, *args, **kwargs):
              self.is_custom_type = True
  
      # test that registration was successful:
      self.assertEqual(crypten.get_default_cryptensor_type(), "mpc")
      crypten.set_default_cryptensor_type(cryptensor_name)
      self.assertEqual(
          crypten.get_default_cryptensor_type(), cryptensor_name
      )
      tensor = crypten.cryptensor(torch.zeros(1, 3))
      self.assertTrue(getattr(tensor, "is_custom_type", False))
      self.assertEqual(
          crypten.get_cryptensor_type(tensor), cryptensor_name
      )
  
imports: import itertools
  import logging
  import math
  import random
  import unittest
  from collections import defaultdict
  import crypten
  import crypten.communicator
  import torch
  import torch.nn.functional
  from crypten.common import serial
  from crypten.common.tensor_types import is_float_tensor
  from crypten.config import cfg
  from test.multiprocess_test_case import get_random_test_tensor, MultiProcessTestCase
  from torch import nn
label_desc: Use image node_id 10 for calling the TestCrypten obj's underlying member method code with example usage: obj.test_cryptensor_registration() without return types