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

Method get

cake-core/src/utils/gguf.rs:194–222  ·  view source on GitHub ↗
(
        &self,
        s: Shape,
        name: &str,
        _h: Init,
        dtype: DType,
        dev: &Device,
    )

Source from the content-addressed store, hash-verified

192
193impl SimpleBackend for GgufBackend {
194 fn get(
195 &self,
196 s: Shape,
197 name: &str,
198 _h: Init,
199 dtype: DType,
200 dev: &Device,
201 ) -> candle_core::Result<Tensor> {
202 let tensor = self
203 .tensors
204 .get(name)
205 .ok_or_else(|| {
206 candle_core::Error::CannotFindTensor {
207 path: name.to_string(),
208 }
209 .bt()
210 })?
211 .to_dtype(dtype)?
212 .to_device(dev)?;
213 if tensor.shape() != &s {
214 Err(candle_core::Error::UnexpectedShape {
215 msg: format!("shape mismatch for {name}"),
216 expected: s,
217 got: tensor.shape().clone(),
218 }
219 .bt())?
220 }
221 Ok(tensor)
222 }
223
224 fn get_unchecked(
225 &self,

Callers 5

config_from_ggufFunction · 0.45
get_uncheckedMethod · 0.45
get_strFunction · 0.45
get_u32Function · 0.45
get_f32Function · 0.45

Calls 2

shapeMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected