class_docstr: A suite of tests for profile directed typing in TorchScript.
class_docstr_tok: ["A","suite","of","tests","for","profile","directed","typing","in","TorchScript","."]
code: def test_nn_parameter_as_arg(self):
      class TestNNParameter(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.inp = torch.nn.Parameter(torch.ones(2, 3))
  
          def add_nn_parameter_with_int(self, x, y):
              return torch.add(x, y)
  
          def forward(self, y):
              return self.add_nn_parameter_with_int(self.inp, y)
  
      make_global(TestNNParameter)
      pdt_model = TestNNParameter()
      scripted_fn = torch.jit.script(
          pdt_model,
          example_inputs={
              pdt_model: [
                  (10,),
              ],
          },
      )
      self.assertEqual(scripted_fn(20), pdt_model(20))
  
imports: import os
  import sys
  import torch
  from torch.testing._internal.jit_utils import JitTestCase, make_global
  from torch.jit._monkeytype_config import _IS_MONKEYTYPE_INSTALLED
  from typing import List, Dict, Tuple, Any, Optional, NamedTuple
  from torch.testing._internal.common_utils import NoTest
label_desc: Use image node_id 16 for calling the TestPDT obj's underlying member method code with example usage: obj.test_nn_parameter_as_arg() and returns: torch, self