From f034827107ca9de1e951fec9acb863991194ce59 Mon Sep 17 00:00:00 2001 From: Florian Fervers Date: Tue, 18 Jun 2024 12:02:17 +0200 Subject: [PATCH] Update docs --- README.md | 8 ++++---- docs/source/faq/universal.rst | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 23f401e..08df201 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,11 @@ x = {np.asarray|torch.as_tensor|jnp.asarray|...}(...) # Create some tensor einx.sum("a [b]", x) # Sum-reduction along second axis einx.flip("... (g [c])", x, c=2) # Flip pairs of values along the last axis -einx.mean("b [s...] c", x) # Spatial mean-pooling -einx.sum("b (s [s2])... c", x, s2=2) # Sum-pooling with kernel_size=stride=2 +einx.mean("b [...] c", x) # Spatial mean-pooling +einx.multiply("a..., b... -> (a b)...", x, y) # Kronecker product +einx.sum("b (s [ds])... c", x, ds=(2, 2)) # Sum-pooling with 2x2 kernel einx.add("a, b -> a b", x, y) # Outer sum +einx.dot("a [b], [b] c -> a c", x, y) # Matmul einx.get_at("b [h w] c, b i [2] -> b i c", x, y) # Gather values at coordinates @@ -52,8 +54,6 @@ einx.vmap("b [s...] c -> b c", x, op=np.mean) # Spatial mean-pooling einx.vmap("a [b], [b] c -> a c", x, y, op=np.dot) # Matmul ``` -All einx functions simply forward computation to the respective backend, e.g. by internally calling `np.reshape`, `np.transpose`, `np.sum` with the appropriate arguments. - #### Common neural network operations ```python diff --git a/docs/source/faq/universal.rst b/docs/source/faq/universal.rst index b99d18a..e70e914 100644 --- a/docs/source/faq/universal.rst +++ b/docs/source/faq/universal.rst @@ -65,8 +65,7 @@ The following tables show examples of classical API calls that can be expressed - ``einx.get_at("[_], ... -> ...", x, y)`` * - ``tf.gather_nd(x, y)`` - ``einx.get_at("[...], b [i] -> b", x, y)`` - * - | ``tf.gather_nd(x, y, batch_dims=1)`` - | ``x[y[..., 0], y[..., 1]]`` + * - ``tf.gather_nd(x, y, batch_dims=1)`` - ``einx.get_at("a [...], a b [i] -> a b", x, y)`` .. list-table:: Example: ``einx.dot`` (similar to einsum)