Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/apple/axlearn
/ gather_fn
Function
gather_fn
axlearn/common/decoding.py:108–109 ·
view source on GitHub ↗
(x)
Source
from the content-addressed store, hash-verified
106
oh_beam_indices = jax.nn.one_hot(beam_indices, old_beam_size, dtype=jnp.int32)
107
108
def
gather_fn(x):
109
return
jnp.einsum(
"bno,bo...->bn..."
, oh_beam_indices, x).astype(x.dtype)
110
111
else
:
112
# True gather via fancy indexing.
Callers
1
_gather_beams
Function · 0.85
Calls
1
astype
Method · 0.80
Tested by
no test coverage detected