code: def test_input_with_baselines(self):
      tokenizer = DummyTokenizer(["a", "b", "c"])
  
      # int baselines
      tt_input = TextTokenInput("a c d", tokenizer, baselines=1)
  
      perturbed_tensor = torch.tensor([[1.0, 0.0, 0.0]])
      expected_perturbed_inp = torch.tensor([[0, 1, 1]])
      assertTensorAlmostEqual(
          self,
          tt_input.to_model_input(perturbed_tensor),
          expected_perturbed_inp,
      )
  
      # str baselines
      tt_input = TextTokenInput("a c d", tokenizer, baselines="b")
      assertTensorAlmostEqual(
          self,
          tt_input.to_model_input(perturbed_tensor),
          expected_perturbed_inp,
      )
  
file_path: captum/tests/attr/test_interpretable_input.py
imports: import torch
  from captum.attr._utils.interpretable_input import TextTemplateInput, TextTokenInput
  from parameterized import parameterized
  from tests.helpers.basic import assertTensorAlmostEqual, BaseTest
label_desc: Use image node_id 2 for calling the TestTextTokenInput obj's underlying member method code with example usage: obj.test_input_with_baselines() without return types