parameters: (module: torch.jit.ScriptModule,
                                   method_name: str,
                                   inputs=[],
                                   device=Device._current_device(),
                                   disable_tf32=False,
                                   sparse_weights=False,
                                   enabled_precisions=set(),
                                   refit=False,
                                   debug=False,
                                   strict_types=False,
                                   capability=_enums.EngineCapability.default,
                                   num_min_timing_iters=2,
                                   num_avg_timing_iters=1,
                                   workspace_size=0,
                                   max_batch_size=0,
                                   truncate_long_and_double=False,
                                   calibrator=None)
return_statement: return _C.convert_graph_to_trt_engine(module._c, method_name, _parse_compile_spec(compile_spec))
docstring: Convert a TorchScript module method to a serialized TensorRT engine
  
      Converts a specified method of a module to a serialized TensorRT engine given a dictionary of conversion settings
  
      Arguments:
          module (torch.jit.ScriptModule): Source module, a result of tracing or scripting a PyTorch
              ``torch.nn.Module``
          method_name (str): Name of method to convert
  
      Keyword Args:
          inputs (List[Union(torch_tensorrt.Input, torch.Tensor)]): **Required** List of specifications of input shape, dtype and memory layout for inputs to the module. This argument is required. Input Sizes can be specified as torch sizes, tuples or lists. dtypes can be specified using
              torch datatypes or torch_tensorrt datatypes and you can use either torch devices or the torch_tensorrt device type enum
              to select device type. ::
  
                  input=[
                      torch_tensorrt.Input((1, 3, 224, 224)), # Static NCHW input shape for input #1
                      torch_tensorrt.Input(
                          min_shape=(1, 224, 224, 3),
                          opt_shape=(1, 512, 512, 3),
                          max_shape=(1, 1024, 1024, 3),
                          dtype=torch.int32
                          format=torch.channel_last
                      ), # Dynamic input shape for input #2
                      torch.randn((1, 3, 224, 244)) # Use an example tensor and let torch_tensorrt infer settings
                  ]
  
          device (Union(torch_tensorrt.Device, torch.device, dict)): Target device for TensorRT engines to run on ::
  
              device=torch_tensorrt.Device("dla:1", allow_gpu_fallback=True)
  
          disable_tf32 (bool): Force FP32 layers to use traditional as FP32 format vs the default behavior of rounding the inputs to 10-bit mantissas before multiplying, but accumulates the sum using 23-bit mantissas
          sparse_weights (bool): Enable sparsity for convolution and fully connected layers.
          enabled_precision (Set(Union(torch.dtype, torch_tensorrt.dtype))): The set of datatypes that TensorRT can use when selecting kernels
          refit (bool): Enable refitting
          debug (bool): Enable debuggable engine
          strict_types (bool): Kernels should strictly run in a particular operating precision. Enabled precision should only have one type in the set
          capability (torch_tensorrt.EngineCapability): Restrict kernel selection to safe gpu kernels or safe dla kernels
          num_min_timing_iters (int): Number of minimization timing iterations used to select kernels
          num_avg_timing_iters (int): Number of averaging timing iterations used to select kernels
          workspace_size (int): Maximum size of workspace given to TensorRT
          max_batch_size (int): Maximum batch size (must be >= 1 to be set, 0 means not set)
          truncate_long_and_double (bool): Truncate weights provided in int64 or double (float64) to int32 and float32
          calibrator (Union(torch_tensorrt._C.IInt8Calibrator, tensorrt.IInt8Calibrator)): Calibrator object which will provide data to the PTQ system for INT8 Calibration
  
      Returns:
          bytes: Serialized TensorRT engine, can either be saved to a file or deserialized via TensorRT APIs
docstring_summary: Convert a TorchScript module method to a serialized TensorRT engine
docstring_tokens: Convert a TorchScript module method to a serialized TensorRT engine
function: def convert_method_to_trt_engine(module: torch.jit.ScriptModule,
                                   method_name: str,
                                   inputs=[],
                                   device=Device._current_device(),
                                   disable_tf32=False,
                                   sparse_weights=False,
                                   enabled_precisions=set(),
                                   refit=False,
                                   debug=False,
                                   strict_types=False,
                                   capability=_enums.EngineCapability.default,
                                   num_min_timing_iters=2,
                                   num_avg_timing_iters=1,
                                   workspace_size=0,
                                   max_batch_size=0,
                                   truncate_long_and_double=False,
                                   calibrator=None) -> str:
      """Convert a TorchScript module method to a serialized TensorRT engine
  
      Converts a specified method of a module to a serialized TensorRT engine given a dictionary of conversion settings
  
      Arguments:
          module (torch.jit.ScriptModule): Source module, a result of tracing or scripting a PyTorch
              ``torch.nn.Module``
          method_name (str): Name of method to convert
  
      Keyword Args:
          inputs (List[Union(torch_tensorrt.Input, torch.Tensor)]): **Required** List of specifications of input shape, dtype and memory layout for inputs to the module. This argument is required. Input Sizes can be specified as torch sizes, tuples or lists. dtypes can be specified using
              torch datatypes or torch_tensorrt datatypes and you can use either torch devices or the torch_tensorrt device type enum
              to select device type. ::
  
                  input=[
                      torch_tensorrt.Input((1, 3, 224, 224)), # Static NCHW input shape for input #1
                      torch_tensorrt.Input(
                          min_shape=(1, 224, 224, 3),
                          opt_shape=(1, 512, 512, 3),
                          max_shape=(1, 1024, 1024, 3),
                          dtype=torch.int32
                          format=torch.channel_last
                      ), # Dynamic input shape for input #2
                      torch.randn((1, 3, 224, 244)) # Use an example tensor and let torch_tensorrt infer settings
                  ]
  
          device (Union(torch_tensorrt.Device, torch.device, dict)): Target device for TensorRT engines to run on ::
  
              device=torch_tensorrt.Device("dla:1", allow_gpu_fallback=True)
  
          disable_tf32 (bool): Force FP32 layers to use traditional as FP32 format vs the default behavior of rounding the inputs to 10-bit mantissas before multiplying, but accumulates the sum using 23-bit mantissas
          sparse_weights (bool): Enable sparsity for convolution and fully connected layers.
          enabled_precision (Set(Union(torch.dtype, torch_tensorrt.dtype))): The set of datatypes that TensorRT can use when selecting kernels
          refit (bool): Enable refitting
          debug (bool): Enable debuggable engine
          strict_types (bool): Kernels should strictly run in a particular operating precision. Enabled precision should only have one type in the set
          capability (torch_tensorrt.EngineCapability): Restrict kernel selection to safe gpu kernels or safe dla kernels
          num_min_timing_iters (int): Number of minimization timing iterations used to select kernels
          num_avg_timing_iters (int): Number of averaging timing iterations used to select kernels
          workspace_size (int): Maximum size of workspace given to TensorRT
          max_batch_size (int): Maximum batch size (must be >= 1 to be set, 0 means not set)
          truncate_long_and_double (bool): Truncate weights provided in int64 or double (float64) to int32 and float32
          calibrator (Union(torch_tensorrt._C.IInt8Calibrator, tensorrt.IInt8Calibrator)): Calibrator object which will provide data to the PTQ system for INT8 Calibration
  
      Returns:
          bytes: Serialized TensorRT engine, can either be saved to a file or deserialized via TensorRT APIs
      """
      if isinstance(module, torch.jit.ScriptFunction):
          raise TypeError(
              "torch.jit.ScriptFunctions currently are not directly supported, wrap the function in a module to compile")
  
      compile_spec = {
          "inputs": inputs,
          "device": device,
          "disable_tf32":
              disable_tf32,  # Force FP32 layers to use traditional as FP32 format vs the default behavior of rounding the inputs to 10-bit mantissas before multiplying, but accumulates the sum using 23-bit mantissas
          "sparse_weights": sparse_weights,  #Enable sparsity for convolution and fully connected layers.
          "enabled_precisions": enabled_precisions,  # Enabling FP16 kernels
          "refit": refit,  # enable refit
          "debug": debug,  # enable debuggable engine
          "strict_types": strict_types,  # kernels should strictly run in operating precision
          "capability": capability,  # Restrict kernel selection to safe gpu kernels or safe dla kernels
          "num_min_timing_iters": num_min_timing_iters,  # Number of minimization timing iterations used to select kernels
          "num_avg_timing_iters": num_avg_timing_iters,  # Number of averaging timing iterations used to select kernels
          "workspace_size": workspace_size,  # Maximum size of workspace given to TensorRT
          "max_batch_size": max_batch_size,  # Maximum batch size (must be >= 1 to be set, 0 means not set)
          "calibrator": calibrator,
          "truncate_long_and_double": truncate_long_and_double
      }
  
      return _C.convert_graph_to_trt_engine(module._c, method_name, _parse_compile_spec(compile_spec))
function_tokens: def convert_method_to_trt_engine ( module : torch . jit . ScriptModule , method_name : str , inputs = [ ] , device = Device . _current_device ( ) , disable_tf32 = False , sparse_weights = False , enabled_precisions = set ( ) , refit = False , debug = False , strict_types = False , capability = _enums . EngineCapability . default , num_min_timing_iters = 2 , num_avg_timing_iters = 1 , workspace_size = 0 , max_batch_size = 0 , truncate_long_and_double = False , calibrator = None ) -> str : if isinstance ( module , torch . jit . ScriptFunction ) : raise TypeError ( "torch.jit.ScriptFunctions currently are not directly supported, wrap the function in a module to compile" ) compile_spec = { "inputs" : inputs , "device" : device , "disable_tf32" : disable_tf32 , # Force FP32 layers to use traditional as FP32 format vs the default behavior of rounding the inputs to 10-bit mantissas before multiplying, but accumulates the sum using 23-bit mantissas "sparse_weights" : sparse_weights , #Enable sparsity for convolution and fully connected layers. "enabled_precisions" : enabled_precisions , # Enabling FP16 kernels "refit" : refit , # enable refit "debug" : debug , # enable debuggable engine "strict_types" : strict_types , # kernels should strictly run in operating precision "capability" : capability , # Restrict kernel selection to safe gpu kernels or safe dla kernels "num_min_timing_iters" : num_min_timing_iters , # Number of minimization timing iterations used to select kernels "num_avg_timing_iters" : num_avg_timing_iters , # Number of averaging timing iterations used to select kernels "workspace_size" : workspace_size , # Maximum size of workspace given to TensorRT "max_batch_size" : max_batch_size , # Maximum batch size (must be >= 1 to be set, 0 means not set) "calibrator" : calibrator , "truncate_long_and_double" : truncate_long_and_double } return _C . convert_graph_to_trt_engine ( module . _c , method_name , _parse_compile_spec ( compile_spec ) )