Skip to content

Commit 05f8a45

Browse files
committed
expand pytorch frontend documentation
1 parent 47d7435 commit 05f8a45

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docs/frontend/pytorch.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ PyTorch and Brevitas
44

55
PyTorch frontend in ``hls4ml`` is implemented by parsing the symbolic trace of the ``torch.fx`` framework. This ensures proper execution graph is captured. Therefore, only models that can be traced with the FX framework can be parsed by ``hls4ml``.
66

7-
PyTorch/Brevitas parser is under heavy development and doesn't yet have the same feature set of the Keras parsers. Feel free to reach out to developers if you find a missing feature that is present in Keras parser and would like it implemented.
7+
Provided the underlying opertion is supported in ``hls4ml``, we generally aim to support the use of both ``torch.nn`` classes and ``torch.nn.functional`` functions in the construction of PyTorch models. Generally, the use of classes is more thoroughly
8+
tested. Please reach out if you experience any issues with either case.
9+
10+
The PyTorch/Brevitas parser is under heavy development and doesn't yet have the same feature set of the Keras parsers. Feel free to reach out to developers if you find a missing feature that is present in Keras parser and would like it implemented.
11+
The direct ingestion of models quantized from brevitas is not yet support. Exporting brevitas models in the ONNX format (see `here <https://xilinx.github.io/brevitas/tutorials/onnx_export.html>`_) and reading those with the ``hls4ml`` QONNX frontend
12+
might be possible, but is untested.
13+
14+
For multi-dimensional tensors, ``hls4ml`` follows the channels-last convention adopted by Keras, whereas PyTorch uses channels-first. By default, ``hls4ml`` will automaticlly transpose any tensors associated with weights and biases of the internal layers
15+
of the model. If the ``io_parallel`` I/O type (see :ref:`Concepts`) is used, a transpose node will be added to the model that also adjusts the input tensors. This is not available in the ``io_stream`` case and inputs must be transposed by the user.
16+
Outputs are not transposed back by default, but in ``io_parallel`` case, a transpose node can be added. If not needed, these adjustments can also be switched off. See :py:class:`~hls4ml.utils.config.config_from_pytorch_model` for details.
817

918
The equivalent of Keras extension API is not yet available for PyTorch parser, and will be provided in the future.

0 commit comments

Comments
 (0)