Skip to content

Commit

Permalink
Update all sanning utility with code from seismo-performer repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Syler1984 committed Aug 31, 2021
1 parent 4d56ced commit 6a9533a
Show file tree
Hide file tree
Showing 26 changed files with 2,217 additions and 1,393 deletions.
625 changes: 280 additions & 345 deletions archive_scan.py

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions fast_attention/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Tensorflow Variant of FAVOR+.

The main attention function in the Tensorflow variant is `favor_attention`.

* In order to use softmax attention, set its argument `kernel_transformation=softmax_kernel_transformation`.
* In order to use generalized ReLU attention, set its argument `kernel_transformation=relu_kernel_transformation`.

To use as a `tf.keras.layers.Layer` module, use the FAVOR `Attention` class instead (after setting the FAVOR+ configuration). This has a similar API to `tf.keras.layers.Attention()`.

## Notes:

* Just like the Jax case, the causal (unidirectional) variant uses custom gradients via `@tf.custom_gradient`, in order to provide significant memory reductions.


Loading

0 comments on commit 6a9533a

Please sign in to comment.