MCPcopy Index your code
hub / github.com/Standard-Intelligence/hertz-dev / init_cache

Method init_cache

transformer.py:368–373  ·  view source on GitHub ↗
(self, bsize, device, dtype, length:int=None)

Source from the content-addressed store, hash-verified

366 self.load_state_dict(checkpoint)
367
368 def init_cache(self, bsize, device, dtype, length:int=None):
369 if self.cache_shape is None:
370 return
371 cache_shape = self.cache_shape.copy()
372 cache_shape[1] = length or cache_shape[1]
373 self.cache = T.full((bsize, *cache_shape), CACHE_FILL_VALUE, device=device, dtype=dtype).transpose(0, 1)
374
375 def deinit_cache(self):
376 self.cache = [None] * len(self.cache)

Callers 1

initialize_stateMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected