MCPcopy Create free account
hub / github.com/evilsocket/cake / flat_to_stack

Method flat_to_stack

cake-core/src/models/luxtts/config.rs:103–112  ·  view source on GitHub ↗

Map a flat layer index to (stack_idx, layer_in_stack).

(&self, flat_idx: usize)

Source from the content-addressed store, hash-verified

101
102 /// Map a flat layer index to (stack_idx, layer_in_stack).
103 pub fn flat_to_stack(&self, flat_idx: usize) -> (usize, usize) {
104 let mut remaining = flat_idx;
105 for (stack_idx, &count) in self.model.fm_decoder_num_layers.iter().enumerate() {
106 if remaining < count {
107 return (stack_idx, remaining);
108 }
109 remaining -= count;
110 }
111 panic!("flat_idx {} out of range", flat_idx);
112 }
113
114 /// Check if a flat layer index is the first layer of its stack.
115 pub fn is_stack_first(&self, flat_idx: usize) -> bool {

Callers 3

is_stack_firstMethod · 0.80
is_stack_lastMethod · 0.80
loadMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected