Devito4PyTorch integrates Devito into PyTorch via defining highly optimized finite difference kernels as PyTorch "layers". Devito4PyTorch is an extension of Devito, a symbolic finite-difference domain specific language that provides a high-level interface to the definition of partial differential equations (PDE), such as wave equation. During backpropagation, Devito4PyTorch calls Devito's adjoint PDE solvers, thus making it possible to backpropagate efficiently through the composition of PDE solvers and neural networks.
You can install the package with pip
via
pip install git+https://github.com/slimgroup/Devito4PyTorch
Or if you want a developper version, you can clone and install the package as
git clone https://github.com/slimgroup/Devito4PyTorch
cd Devito4PyTorch
pip install -e .
If you wish to run experiments using a GPU, you will need to install cudatoolkit
. To do so, you can use conda as:
conda install cudatoolkit=10.1 -c pytorch