File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 12
12
13
13
class InitializedMutableBufferPass (ExportPass ):
14
14
"""
15
- If the buffer has the name "cache_pos", such as in an kv_cache
16
- module with `self.register_buffer("cache_pos", torch.arange(10))`,
17
- mark it with a custom tag which later is used by the emitter to
18
- flag spec.const to True, which provides the mutable buffer with
19
- an initialized state.
15
+ If a buffer has a name that within a specified list, set meta["et_init_buffer"]
16
+ to True, which provides the mutable buffer with an initialized state.
17
+
18
+ As an example, a module with `self.register_buffer("cache_pos", torch.arange(10))`
19
+ when patterns = ["cache_pos"] would have its initial state set instead of being
20
+ left uninitialized by default.
20
21
"""
21
22
22
23
def __init__ (self , patterns : List [str ]) -> None :
You can’t perform that action at this time.
0 commit comments