#### Using Colab Follow the instructions [in this Colab notebook](https://colab.research.google.com/drive/1CrLkqIrydBYP_svnF89UUO-aQEqNPE8x?usp=sharing) #### Locally As of 9/21/2022, `functorch` comes installed alongside a nightly PyTorch binary. Please install a Preview (nightly) PyTorch binary; see https://pytorch.org/ for instructions. Once you've done that, run a quick sanity check in Python: ```py import torch from functorch import vmap x = torch.randn(3) y = vmap(torch.sin)(x) assert torch.allclose(y, x.sin()) ``` #### functorch development setup As of 9/21/2022, `functorch` comes installed alongside PyTorch and is in the PyTorch source tree. Please install [PyTorch from source](https://github.com/pytorch/pytorch#from-source), then, you will be able to `import functorch`. Try to run some tests to make sure all is OK: ```bash pytest test/test_vmap.py -v pytest test/test_eager_transforms.py -v ``` AOTAutograd has some additional optional requirements. You can install them via: ```bash pip install networkx ``` To run functorch tests, please install our test dependencies (`expecttest`, `pyyaml`).
#### Using Colab Follow the instructions [here](https://colab.research.google.com/drive/1GNfb01W_xf8JRu78ZKoNnLqiwcrJrbYG#scrollTo=HJ1srOGeNCGA) #### pip Prerequisite: [Install PyTorch](https://pytorch.org/get-started/locally/) ```bash pip install functorch ``` Finally, run a quick sanity check in python: ```py import torch from functorch import vmap x = torch.randn(3) y = vmap(torch.sin)(x) assert torch.allclose(y, x.sin()) ```