code: def test_functional_call_member_reference(self, functional_call):
      class Module(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.l1 = torch.nn.Linear(1, 1)
              self.register_buffer("buffer", torch.ones(1))
  
          def forward(self, x):
              parameters = tuple(self.parameters())
              buffers = tuple(self.buffers())
              return self.l1(x) + self.buffer, parameters, buffers
  
      module = Module()
      weight = torch.tensor([[2.0]])
      bias = torch.tensor([5.0])
      buffer = torch.tensor([3.0])
      extra = torch.tensor([1.0])
      extra_p = torch.nn.Parameter(extra)
  
      # All weights
      parameters = {
          "l1.weight": weight,
          "l1.bias": bias,
          "buffer": buffer,
      }
      x = torch.randn(1, 1)
      out, parameters, buffers = functional_call(module, parameters, x)
      self.assertEqual(out, x * weight + bias + buffer)
      self.assertEqual(parameters, (weight, bias))
      self.assertEqual(buffers, (buffer,))
      self.assertTrue(
          all(t1 is t2 for t1, t2 in zip(parameters, (weight, bias)))
      )
      self.assertTrue(
          all(t1 is t2 for t1, t2 in zip(buffers, (buffer,)))
      )
  
      # Some weights
      parameters = {"l1.weight": weight}
      x = torch.randn(1, 1)
      out, parameters, buffers = functional_call(module, parameters, x)
      self.assertEqual(out, x * weight + module.l1.bias + module.buffer)
      self.assertEqual(parameters, (weight, module.l1.bias))
      self.assertEqual(buffers, (module.buffer,))
      self.assertTrue(
          all(
              t1 is t2
              for t1, t2 in zip(parameters, (weight, module.l1.bias))
          )
      )
      self.assertTrue(
          all(t1 is t2 for t1, t2 in zip(buffers, (module.buffer,)))
      )
  
      # All weights with extra keys
      parameters = {
          "l1.weight": weight,
          "l1.bias": bias,
          "buffer": buffer,
          "l1.extra": extra,
      }
      x = torch.randn(1, 1)
      out, parameters, buffers = functional_call(module, parameters, x)
      self.assertEqual(out, x * weight + bias + buffer)
      self.assertEqual(parameters, (weight, bias))
      self.assertEqual(buffers, (buffer,))
      self.assertTrue(
          all(t1 is t2 for t1, t2 in zip(parameters, (weight, bias)))
      )
      self.assertTrue(
          all(t1 is t2 for t1, t2 in zip(buffers, (buffer,)))
      )
  
      # All weights with extra keys with parameters
      parameters = {
          "l1.weight": weight,
          "l1.bias": bias,
          "buffer": buffer,
          "l1.extra": extra_p,
      }
      x = torch.randn(1, 1)
      out, parameters, buffers = functional_call(module, parameters, x)
      self.assertEqual(out, x * weight + bias + buffer)
      self.assertEqual(parameters, (weight, bias, extra_p))
      self.assertEqual(buffers, (buffer,))
      self.assertTrue(
          all(
              t1 is t2
              for t1, t2 in zip(parameters, (weight, bias, extra_p))
          )
      )
      self.assertTrue(
          all(t1 is t2 for t1, t2 in zip(buffers, (buffer,)))
      )
  
      # Some weights with extra keys
      parameters = {"l1.weight": weight, "l1.extra": extra}
      x = torch.randn(1, 1)
      out, parameters, buffers = functional_call(module, parameters, x)
      self.assertEqual(out, x * weight + module.l1.bias + module.buffer)
      self.assertEqual(parameters, (weight, module.l1.bias))
      self.assertEqual(buffers, (module.buffer))
      self.assertTrue(
          all(
              t1 is t2
              for t1, t2 in zip(parameters, (weight, module.l1.bias))
          )
      )
      self.assertTrue(
          all(t1 is t2 for t1, t2 in zip(buffers, (module.buffer,)))
      )
  
      # Some weights with extra keys with parameters
      parameters = {"l1.weight": weight, "l1.extra": extra_p}
      x = torch.randn(1, 1)
      out, parameters, buffers = functional_call(module, parameters, x)
      self.assertEqual(out, x * weight + module.l1.bias + module.buffer)
      self.assertEqual(parameters, (weight, module.l1.bias, extra_p))
      self.assertEqual(buffers, (module.buffer))
      self.assertTrue(
          all(
              t1 is t2
              for t1, t2 in zip(
                  parameters, (weight, module.l1.bias, extra_p)
              )
          )
      )
      self.assertTrue(
          all(t1 is t2 for t1, t2 in zip(buffers, (module.buffer,)))
      )
  
      # Set None
      parameters = {"l1.weight": weight, "l1.bias": None}
      x = torch.randn(1, 1)
      out, parameters, buffers = functional_call(module, parameters, x)
      self.assertEqual(out, x * weight + module.buffer)
      self.assertEqual(parameters, (weight,))
      self.assertEqual(buffers, (module.buffer))
      self.assertTrue(
          all(t1 is t2 for t1, t2 in zip(parameters, (weight,)))
      )
      self.assertTrue(
          all(t1 is t2 for t1, t2 in zip(buffers, (module.buffer,)))
      )
  
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 27 for calling the TestStatelessFunctionalAPI obj's underlying member method code with example usage: obj.test_functional_call_member_reference(functional_call) and returns: unknown,  parameters,  buffers