class_docstr: Model optimized using TensorRT.
  
  The class cannot be directly instantiated, but implements all the core
  methods needed for using TensorRT at inference time.
  
  Attributes:
      network_parameters (ModelParams): The model parameters as batch
              size, input and output sizes.
      engine (any): The tensorRT engine.
      input_names (List[str]): Names associated to the model input tensors.
      output_names (List[str]): Names associated to the model output tensors.
      cuda_stream (any, optional): Stream used for communication with Nvidia
          GPUs.
      nvidia_logger (any, optional): Logger used by the Nvidia service
class_docstr_tok: ["Model","optimized","using","TensorRT",".","The","class","can","not","be","directly","instantiated",",","but","implements","all","the","core","methods","needed","for","using","TensorRT","at","inference","time",".","Attributes",":","network_parameters","(","ModelParams",")",":","The","model","parameters","as","batch","size",",","input","and","output","sizes",".","engine","(","any",")",":","The","tensorRT","engine",".","input_names","(","List","[","str","]",")",":","Names","associated","to","the","model","input","tensors",".","output_names","(","List","[","str","]",")",":","Names","associated","to","the","model","output","tensors",".","cuda_stream","(","any",",","optional",")",":","Stream","used","for","communication","with","Nvidia","GPUs",".","nvidia_logger","(","any",",","optional",")",":","Logger","used","by","the","Nvidia","service"]
docstr: Save the model.
  
  Args:
      path (Path or str): Path to the directory where the model will
          be stored.
      kwargs (Dict): Dictionary of key-value pairs that will be saved in
          the model metadata file.
code: def save(self, path: Union[str, Path], **kwargs):
      """Save the model.
  
      Args:
          path (Path or str): Path to the directory where the model will
              be stored.
          kwargs (Dict): Dictionary of key-value pairs that will be saved in
              the model metadata file.
      """
      path = Path(path)
      path.mkdir(exist_ok=True)
      serialized_engine = self.engine.serialize()
      with open(path / NVIDIA_FILENAMES["engine"], "wb") as fout:
          fout.write(serialized_engine)
      metadata = self._get_metadata(**kwargs)
      with open(path / NVIDIA_FILENAMES["metadata"], "w") as fout:
          json.dump(metadata.to_dict(), fout)
  
imports: import json
  import os
  from abc import ABC
  from pathlib import Path
  from tempfile import TemporaryDirectory
  from typing import Any, Union, Dict, Type, List, Tuple, Generator, Optional
  import numpy
  from loguru import logger
  from nebullvm.config import NVIDIA_FILENAMES
  from nebullvm.core.models import Device, DeviceType, ModelParams, DeepLearningFramework
  from nebullvm.operations.inference_learners.base import BaseInferenceLearner, LearnerMetadata, PytorchBaseInferenceLearner, TensorflowBaseInferenceLearner, NumpyBaseInferenceLearner
  from nebullvm.optional_modules.tensorflow import tensorflow
  from nebullvm.optional_modules.tensor_rt import tensorrt, polygraphy
  from nebullvm.optional_modules.torch import torch, ScriptModule
  from nebullvm.tools.data import DataManager
  from nebullvm.tools.transformations import MultiStageTransformation, VerifyContiguity
label_desc: Use image node_id 12 for calling the ONNXTensorRTInferenceLearner obj's underlying member method code with example usage: obj.save(path) without return types