pub enum TensorInit {
Zero,
Pattern {
modulus: i64,
shift: i64,
},
Values(Vec<i64>),
FloatValues(Vec<u64>),
ConstF(u64),
RandomBf16 {
seed: u32,
shift_milli: i32,
},
External,
}Expand description
How a tensor’s contents are produced — recognized from the source’s array-build loop, so a host can reproduce the data and the numerics claim can bound the operand range.
Variants§
Zero
Pattern
value[p] = (p % modulus) + shift.
Values(Vec<i64>)
FloatValues(Vec<u64>)
Float values (as bits, so the init stays hashable).
ConstF(u64)
★ ONE CONSTANT, NOT N COPIES OF IT. A tensor every element of which is the same float is a fact
about the tensor, not n facts — but the only float fill used to be FloatValues, so declaring
one cost a Vec as long as the tensor. On Qwen3.8 that is not a rounding error: a single
full-width layer materialized 386,754,784 elements — 3.1 GB — and the real 64-layer model with its
5120 x 248320 output projection exhausted 114 GB of a 125 GB box before it finished lowering.
Held symbolically the same declaration is eight bytes.
RandomBf16
A vendor-style bf16 random fill (seed + shift in thousandths) — carried so a recorded PCC is reproducible.
External
Supplied at run time.
Implementations§
Source§impl TensorInit
impl TensorInit
Trait Implementations§
Source§impl Clone for TensorInit
impl Clone for TensorInit
Source§fn clone(&self) -> TensorInit
fn clone(&self) -> TensorInit
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TensorInit
impl Debug for TensorInit
Source§impl<'de> Deserialize<'de> for TensorInit
impl<'de> Deserialize<'de> for TensorInit
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for TensorInit
impl Hash for TensorInit
Source§impl PartialEq for TensorInit
impl PartialEq for TensorInit
Source§impl Serialize for TensorInit
impl Serialize for TensorInit
impl Eq for TensorInit
impl StructuralPartialEq for TensorInit
Auto Trait Implementations§
impl Freeze for TensorInit
impl RefUnwindSafe for TensorInit
impl Send for TensorInit
impl Sync for TensorInit
impl Unpin for TensorInit
impl UnsafeUnpin for TensorInit
impl UnwindSafe for TensorInit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.