code: def config_from_pytorch_model(
      model,
      granularity="model",
      backend=None,
      default_precision="ap_fixed<16,6>",
      default_reuse_factor=1,
      inputs_channel_last=False,
      transpose_outputs=True,
  ):
      """Create an HLS conversion config given the PyTorch model.
  
      This function serves as the initial step in creating the custom conversion configuration.
      Users are advised to inspect the returned object to tweak the conversion configuration.
      The return object can be passed as `hls_config` parameter to `convert_from_pytorch_model`.
  
      Args:
          model: PyTorch model
          granularity (str, optional): Granularity of the created config. Defaults to 'model'.
              Can be set to 'model', 'type' and 'layer'.
  
              Granularity can be used to generate a more verbose config that can be fine-tuned.
              The default granularity ('model') will generate config keys that apply to the whole
              model, so changes to the keys will affect the entire model. 'type' granularity will
              generate config keys that affect all layers of a given type, while the 'name' granularity
              will generate config keys for every layer separately, allowing for highly specific
              configuration tweaks.
          backend(str, optional): Name of the backend to use
          default_precision (str, optional): Default precision to use. Defaults to 'fixed<16,6>'.
          default_reuse_factor (int, optional): Default reuse factor. Defaults to 1.
          inputs_channel_last (bool, optional): Set to 'True' if input to the model comes in format
              'channels_last'. Defaults to 'False'. If False, inputs will be transposed internally.
          transpose_outputs (bool, optional): Set to 'False' if the output should not be transposed from
              channels_last into channels_first data format. Defaults to 'False'. If False, outputs needs
              to be transposed manually.
  
      Raises:
          Exception: If PyTorch model has layers not supported by hls4ml.
  
      Returns:
          [dict]: The created config.
      """
  
      config = {}
  
      model_config = {}
      model_config["Precision"] = default_precision
      model_config["ReuseFactor"] = default_reuse_factor
      model_config["InputsChannelLast"] = inputs_channel_last
      model_config["TransposeOutputs"] = transpose_outputs
      model_config["Strategy"] = "Latency"
  
      config["Model"] = model_config
  
      return config
  
file_path: hls4ml/hls4ml/utils/config.py
imports: import json
  import qkeras
  import hls4ml
label_desc: Use image node_id 4 for calling a global function with example usage: config_from_pytorch_model(model, granularity, backend, default_precision, default_reuse_factor, inputs_channel_last, transpose_outputs) and returns: config