https://github.com/mvinyard/brownian-diffuser
Forward integrate torch neural networks
https://github.com/mvinyard/brownian-diffuser
dynamical-systems generative-modeling pytorch
Last synced: 7 months ago
JSON representation
Forward integrate torch neural networks
- Host: GitHub
- URL: https://github.com/mvinyard/brownian-diffuser
- Owner: mvinyard
- License: mit
- Created: 2023-01-03T19:59:24.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-09T23:09:54.000Z (over 2 years ago)
- Last Synced: 2025-02-25T05:20:24.476Z (8 months ago)
- Topics: dynamical-systems, generative-modeling, pytorch
- Language: Python
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# brownian-diffuser
Forward integrate torch neural networks
Similar to [`torchsde.sdeint`](https://github.com/google-research/torchsde) or [`torchdiffeq.odeint`](https://github.com/rtqichen/torchdiffeq) but for vanilla neural networks as implemented by [`TorchNets`](https://github.com/mvinyard/torch-nets/)
### Example usage
**`BrownianDiffuser`**
```python
from brownian_diffuser import BrownianDiffuserdiffuser = BrownianDiffuser()
``````python
from torch_nets import TorchNet
import torchnet = TorchNet(50, 50, [400, 400])
X0 = torch.randn([200, 50])
t = torch.Tensor([2, 4, 6])
``````python
X_pred = diffuser(net, X0, t, n_steps=40, stdev=0.5, max_steps=None, return_all=False)
X_pred.shape
```
```
torch.Size([3, 200, 50])
```**`BrownianMotion`**
```python
from brownian_diffuser import BrownianMotionX_state = torch.randn([400, 50])
BM = BrownianMotion(X_state, stdev=0.5, n_steps=40)
Z = BM()
Z.shape
```
```
torch.Size([40, 400, 50])
```### Installation
```
pip install brownian-diffuser
```