Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyxu committed Nov 13, 2022
1 parent 4afc38c commit 8cc576c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/advanced.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Advanced Usage
==============

The following sections outline advanced usage in :mod:`torchensemble`.

Faster inference using functorch
--------------------------------

:mod:`functorch` has been integrated into Pytorch since the release of version 1.13, which is JAX-like composable function transforms for PyTorch. To enable faster inference of ensembles in :mod:`torchensemble`, you could use :meth:`vectorize` method of the ensemble to convert it into a stateless version (fmodel), and stacked parameters and buffers.

The stateless model, parameters, along with buffers could be used to reduce the inference time using :meth:`vmap` in :mod:`functorch`. More details are available at `functorch documentation <https://pytorch.org/functorch/stable/notebooks/ensembling.html>`__. The code snippet below demonstrates how to pass :meth:`ensemble.vectorize` results into :meth:`functorch.vmap`.

.. code:: python
from torchensemble import VotingClassifier # voting is a classic ensemble strategy
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Content
Guidance <guide>
Experiment <experiment>
API Reference <parameters>
Advanced Usage <advanced>

.. toctree::
:maxdepth: 1
Expand Down

1 comment on commit 8cc576c

@binunalex
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear xuyxu, please tell me: how must one define the ground truth variables (labels) and features in the train/test loaders ?

I did not understand where are labels and features.

With due respect,
Alex Binun

Please sign in to comment.