This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # fluent-sync.sh โ keep your Fluent learning data in sync across machines | |
| # using a PRIVATE GitHub repository. | |
| # | |
| # init Machine 1 (first time): create the private repo, commit, push. | |
| # clone Machine 2 (first time): clone the repo into the data dir. | |
| # push After a session: commit local changes and upload. | |
| # pull Before/after switching machines: download latest. | |
| # sync The everyday command: pull --rebase then push. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Refer to `https://j-towns.github.io/2017/06/12/A-new-trick.html` for math details. | |
| import torch | |
| from torch import nn | |
| from torch import autograd | |
| def get_jvp(net, x, v): | |
| ''' | |
| Generate jacobian vector product. Requires x.requires_grad() | |
| and v.requires_grad(). | |
| Args: |