code: def test_interpretable_embedding_base(self) -> None:
      input1 = torch.tensor([2, 5, 0, 1])
      input2 = torch.tensor([3, 0, 0, 2])
      model = BasicEmbeddingModel()
      output = model(input1, input2)
      interpretable_embedding1 = (
          configure_interpretable_embedding_layer(model, "embedding1")
      )
      self.assertEqual(model.embedding1, interpretable_embedding1)
      self._assert_embeddings_equal(
          input1,
          output,
          interpretable_embedding1,
          model.embedding1.embedding_dim,
          model.embedding1.num_embeddings,
      )
      interpretable_embedding2 = (
          configure_interpretable_embedding_layer(
              model, "embedding2.inner_embedding"
          )
      )
      self.assertEqual(
          model.embedding2.inner_embedding, interpretable_embedding2
      )
      self._assert_embeddings_equal(
          input2,
          output,
          interpretable_embedding2,
          model.embedding2.inner_embedding.embedding_dim,
          model.embedding2.inner_embedding.num_embeddings,
      )
      # configure another embedding when one is already configured
      with self.assertRaises(AssertionError):
          configure_interpretable_embedding_layer(
              model, "embedding2.inner_embedding"
          )
      with self.assertRaises(AssertionError):
          configure_interpretable_embedding_layer(model, "embedding1")
      # remove interpretable embedding base
      self.assertTrue(
          model.embedding2.inner_embedding.__class__
          is InterpretableEmbeddingBase
      )
      remove_interpretable_embedding_layer(
          model, interpretable_embedding2
      )
      self.assertTrue(
          model.embedding2.inner_embedding.__class__ is Embedding
      )
  
      self.assertTrue(
          model.embedding1.__class__ is InterpretableEmbeddingBase
      )
      remove_interpretable_embedding_layer(
          model, interpretable_embedding1
      )
      self.assertTrue(model.embedding1.__class__ is Embedding)
  
file_path: captum/tests/attr/models/test_base.py
imports: from __future__ import print_function
  import unittest
  import torch
  from captum.attr._models.base import configure_interpretable_embedding_layer, InterpretableEmbeddingBase, remove_interpretable_embedding_layer
  from tests.helpers.basic import assertTensorAlmostEqual
  from tests.helpers.basic_models import BasicEmbeddingModel, TextModule
  from torch.nn import Embedding
label_desc: Use image node_id 1 for calling the Test obj's underlying member method code with example usage: obj.test_interpretable_embedding_base() without return types