code: def test_tied_weights_errors(self, functional_call):
      module = MockTiedModule()
      weight = torch.tensor([[1.0]])
      bias = torch.tensor([0.0])
      buffer = torch.tensor([0.0])
  
      parameters = {
          "l1.weight": weight,
          "l1.bias": bias,
          "buffer": buffer,
      }
      x = torch.randn(1, 1)
      self.assertNotWarn(
          lambda: functional_call(
              module, parameters, x, tie_weights=True
          )
      )
  
      # if tied values are the same tensors, shouldn't warn
      parameters["tied_bias"] = bias
      parameters["tied_buffer"] = buffer
      self.assertNotWarn(
          lambda: functional_call(
              module, parameters, x, tie_weights=True
          )
      )
      del parameters["tied_bias"]
      del parameters["tied_buffer"]
  
      with self.assertRaisesRegex(
          ValueError,
          re.escape(
              "functional_call got multiple values for keys ['l1.bias', 'tied_bias']"
          ),
      ):
          parameters["tied_bias"] = torch.tensor([5.0])
          functional_call(module, parameters, x, tie_weights=True)
      del parameters["tied_bias"]
  
      with self.assertRaisesRegex(
          ValueError,
          re.escape(
              "functional_call got multiple values for keys ['buffer', 'tied_buffer']"
          ),
      ):
          parameters["tied_buffer"] = torch.tensor([5.0])
          functional_call(module, parameters, x, tie_weights=True)
  
imports: import contextlib
  import os
  import re
  import subprocess
  import sys
  import unittest
  import torch
  import torch.nn.utils.stateless
  from torch.testing._internal.common_cuda import TEST_MULTIGPU
  from torch.testing._internal.common_utils import run_tests, TestCase, parametrize, instantiate_parametrized_tests, subtest
label_desc: Use image node_id 18 for calling the TestStatelessFunctionalAPI obj's underlying member method code with example usage: obj.test_tied_weights_errors(functional_call) without return types