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

Function graph_pad2d

src/framework/audio/zipenhancer.cpp:156–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156core::TensorValue graph_pad2d(
157 core::ModuleBuildContext & ctx,
158 const core::TensorValue & input,
159 int64_t left,
160 int64_t right,
161 int64_t top,
162 int64_t bottom) {
163 std::array<int32_t, 4> lp = {0, 0, 0, 0};
164 std::array<int32_t, 4> rp = {0, 0, 0, 0};
165 const auto contiguous = core::ensure_backend_addressable_layout(ctx, input);
166 lp[core::logical_axis_to_ggml_axis(contiguous.shape.rank, 2)] = static_cast<int32_t>(top);
167 rp[core::logical_axis_to_ggml_axis(contiguous.shape.rank, 2)] = static_cast<int32_t>(bottom);
168 lp[core::logical_axis_to_ggml_axis(contiguous.shape.rank, 3)] = static_cast<int32_t>(left);
169 rp[core::logical_axis_to_ggml_axis(contiguous.shape.rank, 3)] = static_cast<int32_t>(right);
170 auto shape = input.shape;
171 shape.dims[2] += top + bottom;
172 shape.dims[3] += left + right;
173 return core::wrap_tensor(
174 ggml_pad_ext(ctx.ggml, contiguous.tensor, lp[0], rp[0], lp[1], rp[1], lp[2], rp[2], lp[3], rp[3]),
175 shape,
176 input.type);
177}
178
179core::TensorValue graph_conv2d(
180 core::ModuleBuildContext & ctx,

Callers 1

graph_dense_blockFunction · 0.70

Calls 4

wrap_tensorFunction · 0.85
ggml_pad_extFunction · 0.85

Tested by

no test coverage detected