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

Function build_depthwise_conv2d

src/models/sortformer_diar/graph.cpp:91–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89 }
90 return values;
91}
92
93} // namespace
94
95SortformerInferenceGraph::~SortformerInferenceGraph() {
96 if (plan != nullptr) {
97 engine::core::free_backend_graph_plan(backend, plan);
98 }
99 if (buffer != nullptr) {
100 ggml_backend_buffer_free(buffer);
101 }
102 if (ggml != nullptr) {
103 ggml_free(ggml);
104 }
105}
106
107int64_t sortformer_conv_valid_length(int64_t valid, int64_t kernel, int64_t stride, int64_t padding) {
108 if (valid <= 0) {
109 return 0;
110 }
111 const int64_t numerator = valid + 2 * padding - kernel;
112 if (numerator < 0) {
113 return 0;
114 }
115 return numerator / stride + 1;
116}
117
118void fill_sortformer_keep_mask(std::vector<int32_t> & mask, int64_t frames, int64_t valid_frames) {
119 mask.assign(static_cast<size_t>(frames), 0);
120 const int64_t clamped = std::clamp<int64_t>(valid_frames, 0, frames);
121 for (int64_t i = 0; i < clamped; ++i) {
122 mask[static_cast<size_t>(i)] = 1;
123 }
124}
125
126void fill_sortformer_transformer_attention_mask(

Callers 1

Calls 6

conv_output_dimFunction · 0.85
ggml_is_quantizedFunction · 0.85
wrap_tensorFunction · 0.85
ggml_castFunction · 0.85
ggml_conv_2d_dw_directFunction · 0.85
add_channel_bias_4dFunction · 0.85

Tested by

no test coverage detected