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

Function matmul_f32

src/models/ace_step/diffusion.cpp:73–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 ctx,
72 contiguous,
73 core::TensorShape::from_dims({input.shape.dims[0], input.shape.dims[1], heads, dim}));
74}
75
76core::TensorValue repeat_kv_heads(core::ModuleBuildContext & ctx, const core::TensorValue & input, int64_t repeats) {
77 if (repeats == 1) {
78 return input;
79 }
80 std::vector<core::TensorValue> heads;
81 heads.reserve(static_cast<size_t>(input.shape.dims[1] * repeats));
82 for (int64_t head = 0; head < input.shape.dims[1]; ++head) {
83 auto one = modules::SliceModule({1, head, 1}).build(ctx, input);
84 for (int64_t rep = 0; rep < repeats; ++rep) {
85 heads.push_back(one);
86 }
87 }
88 auto output = heads.front();
89 for (size_t i = 1; i < heads.size(); ++i) {
90 output = modules::ConcatModule({1}).build(ctx, output, heads[i]);
91 }
92 return output;
93}
94
95core::TensorValue attention_from_heads(
96 core::ModuleBuildContext & ctx,
97 const core::TensorValue & q_heads,
98 const core::TensorValue & k_heads,
99 const core::TensorValue & v_heads,
100 int64_t dim,

Callers 1

attention_from_headsFunction · 0.70

Calls 8

validate_rank_betweenFunction · 0.85
TransposeModuleClass · 0.85
ggml_mul_matFunction · 0.85
ggml_mul_mat_set_precFunction · 0.85
wrap_tensorFunction · 0.85
transpose_last_two_axesFunction · 0.70
ensure_contiguousFunction · 0.70
buildMethod · 0.45

Tested by

no test coverage detected