MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / BeamState

Class BeamState

beam_search.py:176–191  ·  view source on GitHub ↗

Holds beam search state data.

Source from the content-addressed store, hash-verified

174
175@flax.struct.dataclass
176class BeamState:
177 """Holds beam search state data."""
178
179 # The position of the decoding loop in the length dimension.
180 cur_index: jax.Array # scalar int32: current decoded length index
181 # The active sequence log probabilities and finished sequence scores.
182 live_logprobs: jax.Array # float32: [batch_size, beam_size]
183 finished_scores: jax.Array # float32: [batch_size, beam_size]
184 # The current active-beam-searching and finished sequences.
185 live_seqs: jax.Array # int32: [batch_size, beam_size, max_decode_len]
186 finished_seqs: jax.Array # int32: [batch_size, beam_size,
187 # max_decode_len]
188 # Records which of the 'finished_seqs' is occupied and not a filler slot.
189 finished_flags: jax.Array # bool: [batch_size, beam_size]
190 # The current state of the autoregressive decoding caches.
191 cache: Any # Any pytree of arrays, e.g. flax attention Cache object
192
193
194def beam_init(seed_token, batch_size, beam_size, max_decode_len, cache):

Callers 2

beam_initFunction · 0.85
beam_search_loop_body_fnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected