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

Function graph_pad2d

src/framework/audio/deepfilternet2.cpp:195–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195core::TensorValue graph_pad2d(
196 core::ModuleBuildContext & ctx,
197 const core::TensorValue & input,
198 int64_t left,
199 int64_t right,
200 int64_t top,
201 int64_t bottom) {
202 std::array<int32_t, 4> lp = {0, 0, 0, 0};
203 std::array<int32_t, 4> rp = {0, 0, 0, 0};
204 lp[core::logical_axis_to_ggml_axis(input.shape.rank, 2)] = static_cast<int32_t>(top);
205 rp[core::logical_axis_to_ggml_axis(input.shape.rank, 2)] = static_cast<int32_t>(bottom);
206 lp[core::logical_axis_to_ggml_axis(input.shape.rank, 3)] = static_cast<int32_t>(left);
207 rp[core::logical_axis_to_ggml_axis(input.shape.rank, 3)] = static_cast<int32_t>(right);
208 auto shape = input.shape;
209 shape.dims[2] += top + bottom;
210 shape.dims[3] += left + right;
211 return core::wrap_tensor(
212 ggml_pad_ext(ctx.ggml, input.tensor, lp[0], rp[0], lp[1], rp[1], lp[2], rp[2], lp[3], rp[3]),
213 shape,
214 input.type);
215}
216
217core::TensorValue graph_contiguous(core::ModuleBuildContext & ctx, const core::TensorValue & input) {
218 return core::ensure_backend_addressable_layout(ctx, input);

Callers 1

graph_conv2d_norm_actFunction · 0.70

Calls 3

wrap_tensorFunction · 0.85
ggml_pad_extFunction · 0.85

Tested by

no test coverage detected