Skip to content

Commit 8cc576c

Browse files
committed
update doc
1 parent 4afc38c commit 8cc576c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

docs/advanced.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Advanced Usage
2+
==============
3+
4+
The following sections outline advanced usage in :mod:`torchensemble`.
5+
6+
Faster inference using functorch
7+
--------------------------------
8+
9+
: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.
10+
11+
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`.
12+
13+
.. code:: python
14+
15+
from torchensemble import VotingClassifier # voting is a classic ensemble strategy

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Content
7272
Guidance <guide>
7373
Experiment <experiment>
7474
API Reference <parameters>
75+
Advanced Usage <advanced>
7576

7677
.. toctree::
7778
:maxdepth: 1

0 commit comments

Comments
 (0)