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

Function build_time_embedding

src/models/ace_step/diffusion.cpp:272–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270 int64_t plane,
271 int64_t hidden_size,
272 int64_t seq_len) {
273 auto slice = modules::SliceModule({1, plane, 1}).build(ctx, conditioning);
274 slice = ensure_contiguous(ctx, slice);
275 slice = core::reshape_tensor(
276 ctx,
277 slice,
278 core::TensorShape::from_dims({conditioning.shape.dims[0], hidden_size}));
279 return expand_conditioning(ctx, slice, seq_len);
280}
281
282core::TensorValue dit_layer(
283 core::ModuleBuildContext & ctx,
284 const core::TensorValue & hidden_states,
285 const core::TensorValue & positions,
286 const core::TensorValue & timestep_proj,
287 const core::TensorValue & one,
288 const std::optional<core::TensorValue> & self_attention_mask,
289 const core::TensorValue & encoder_attention_mask,
290 const AceStepDiTLayerWeights & weights,
291 const AceStepDiffusionConfig & config,
292 bool flash_attention,
293 const std::optional<PrecomputedCrossAttentionKV> & cross_attention_kv,
294 const std::optional<core::TensorValue> & encoder_hidden_states = std::nullopt) {
295 const int64_t hidden_size = config.hidden_size;
296 const int64_t seq_len = hidden_states.shape.dims[1];
297 auto scale_shift_table = modules::RepeatModule({timestep_proj.shape}).build(ctx, ensure_f32(ctx, weights.scale_shift_table));

Callers 1

buildMethod · 0.85

Calls 9

wrap_tensorFunction · 0.85
ggml_scaleFunction · 0.85
ggml_cosFunction · 0.85
ggml_sinFunction · 0.85
ConcatModuleClass · 0.85
LinearModuleClass · 0.85
reshape_tensorFunction · 0.85
buildMethod · 0.45

Tested by

no test coverage detected