| 154 | } |
| 155 | |
| 156 | core::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 | |
| 179 | core::TensorValue graph_conv2d( |
| 180 | core::ModuleBuildContext & ctx, |
no test coverage detected