MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / reorder_cache

Method reorder_cache

deepspeed/utils/static_cache.py:200–205  ·  view source on GitHub ↗
(self, beam_idx: torch.LongTensor)

Source from the content-addressed store, hash-verified

198 self.values[:, :, -count:].zero_()
199
200 def reorder_cache(self, beam_idx: torch.LongTensor) -> None:
201 if self.is_initialized:
202 self.keys = self.keys.index_select(0, beam_idx.to(self.keys.device))
203 self.values = self.values.index_select(0, beam_idx.to(self.values.device))
204 if self._write_position is not None and self._write_position.dim() == 1:
205 self._write_position = self._write_position.index_select(0, beam_idx.to(self._write_position.device))
206
207
208class DSStaticGDNSlot:

Callers

nothing calls this directly

Calls 1

toMethod · 0.45

Tested by

no test coverage detected