Skip to main content

load_constant_tensors

Function load_constant_tensors 

Source
pub(crate) fn load_constant_tensors(dir: &Path) -> Result<Vec<ConstantTensor>>
Expand description

Read <tensor-name>.bin for every tensor the caller supplied.

The naming follows --calibration-data, which is the convention this project already has for feeding a directory of external data in. Only the file stem is used, so weight.bin supplies the tensor a WGSL kernel binds as weight.

Nothing is invented here. A tensor with no file stays a graph input, and the backend says what that costs; filling one with zeros to win an acceleration would produce a model that runs, is attributed to the accelerator, and computes the wrong thing.