| 193 | } |
| 194 | |
| 195 | core::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 | |
| 217 | core::TensorValue graph_contiguous(core::ModuleBuildContext & ctx, const core::TensorValue & input) { |
| 218 | return core::ensure_backend_addressable_layout(ctx, input); |
no test coverage detected