code: def convert_from_pytorch_model(
      model,
      input_shape,
      output_dir="my-hls-test",
      project_name="myproject",
      input_data_tb=None,
      output_data_tb=None,
      backend="Vivado",
      hls_config=None,
      **kwargs,
  ):
      """Convert PyTorch model to hls4ml model based on the provided configuration.
  
      Args:
          model: PyTorch model to convert.
          input_shape (list): The shape of the input tensor. First element is the batch size, needs to be None
          output_dir (str, optional): Output directory of the generated HLS project. Defaults to 'my-hls-test'.
          project_name (str, optional): Name of the HLS project. Defaults to 'myproject'.
          input_data_tb (str, optional): String representing the path of input data in .npy or .dat format that will be
              used during csim and cosim. Defaults to None.
          output_data_tb (str, optional): String representing the path of output data in .npy or .dat format that will be
              used during csim and cosim. Defaults to None.
          backend (str, optional): Name of the backend to use, e.g., 'Vivado' or 'Quartus'. Defaults to 'Vivado'.
          board (str, optional): One of target boards specified in `supported_board.json` file. If set to `None` a default
              device of a backend will be used. See documentation of the backend used.
          part (str, optional): The FPGA part. If set to `None` a default part of a backend will be used.
              See documentation of the backend used. Note that if `board` is specified, the part associated to that board
              will overwrite any part passed as a parameter.
          clock_period (int, optional): Clock period of the design.
              Defaults to 5.
          io_type (str, optional): Type of implementation used. One of
              'io_parallel' or 'io_stream'. Defaults to 'io_parallel'.
          hls_config (dict, optional): The HLS config.
          kwargs** (dict, optional): Additional parameters that will be used to create the config of the specified backend.
  
      Raises:
          Exception: If precision and reuse factor are not present in 'hls_config'.
  
      Notes:
          Pytorch uses the "channels_first" data format for its tensors, while hls4ml expects the "channels_last" format
          used by keras. By default, hls4ml will automatically add layers to the model which transpose the inputs to the
          "channels_last"format. Not that this is not supported for the "io_stream" io_type, for which the user will have
          to transpose the input by hand before passing it to hls4ml. In that case the "inputs_channel_last" argument of
          the "config_from_pytorch_model" function needs to be set to True. By default, the output of the model remains
          in the "channels_last" data format. The "transpose_outputs" argument of the "config_from_pytorch_model" can be
          used to add a layer to the model that transposes back to "channels_first". As before, this will not work for
          io_stream.
  
      Returns:
          ModelGraph: hls4ml model.
      """
  
      config = create_config(
          output_dir=output_dir,
          project_name=project_name,
          backend=backend,
          **kwargs,
      )
  
      config["PytorchModel"] = model
      config["InputShape"] = input_shape
      config["InputData"] = input_data_tb
      config["OutputPredictions"] = output_data_tb
      config["HLSConfig"] = {}
  
      if hls_config is None:
          hls_config = {}
  
      model_config = hls_config.get("Model", None)
      config["HLSConfig"]["Model"] = _check_model_config(model_config)
  
      _check_hls_config(config, hls_config)
  
      return pytorch_to_hls(config)
  
imports: import importlib
  import os
  import warnings
  import yaml
  from hls4ml.converters.keras_to_hls import KerasFileReader
  from hls4ml.converters.keras_to_hls import KerasModelReader
  from hls4ml.converters.keras_to_hls import KerasReader
  from hls4ml.converters.keras_to_hls import get_supported_keras_layers
  from hls4ml.converters.keras_to_hls import parse_keras_model
  from hls4ml.converters.keras_to_hls import keras_to_hls, register_keras_layer_handler
  from hls4ml.model import ModelGraph
  from hls4ml.utils.config import create_config
  from hls4ml.utils.symbolic_utils import LUTFunction
label_desc: Use image node_id 6 for calling a global function with example usage: convert_from_pytorch_model(model, input_shape, output_dir, project_name, input_data_tb, output_data_tb, backend, hls_config) and returns: pytorch_to_hls