MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / planner_cache_view

Function planner_cache_view

src/models/ace_step/planner.cpp:300–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298 }
299 if (step_start < 0 || step_count <= 0 || step_start + step_count > cache.shape.dims[1]) {
300 throw std::runtime_error("ACE-Step planner cache step range is invalid");
301 }
302 const size_t byte_offset = static_cast<size_t>(batch_start) * cache.tensor->nb[3] +
303 static_cast<size_t>(step_start) * cache.tensor->nb[2];
304 return core::wrap_tensor(
305 ggml_view_4d(
306 ctx.ggml,
307 cache.tensor,
308 dim,
309 heads,
310 step_count,
311 batch_count,
312 cache.tensor->nb[1],
313 cache.tensor->nb[2],
314 cache.tensor->nb[3],
315 byte_offset),
316 core::TensorShape::from_dims({batch_count, step_count, heads, dim}),
317 cache.type);
318}
319
320modules::DecoderLayerOutputs planner_decoder_layer_batched(
321 core::ModuleBuildContext & ctx,
322 const core::TensorValue & input,
323 const core::TensorValue & positions,
324 const DecoderLayerWeights & weights,
325 const AceStepQwen3PlannerConfig & config,
326 const core::TensorValue & attention_mask,
327 const core::TensorValue & query_mask,
328 ggml_type activation_type) {
329 const int64_t dim = planner_attention_head_dim(config);
330
331 auto x_norm = modules::RMSNormModule({config.hidden_size, config.rms_norm_eps, true, weights.input_norm.bias.has_value()})
332 .build(ctx, input, weights.input_norm);
333 core::TensorValue q, k, v;
334 if (weights.self_attention.qkv_weight.has_value()) {

Calls 2

wrap_tensorFunction · 0.85
ggml_view_4dFunction · 0.85

Tested by

no test coverage detected