| 190 | std::string("DepthwiseConv2dModule does not support weight type with the current ggml depthwise conv path: ") + |
| 191 | ggml_type_name(contiguous.type)); |
| 192 | } |
| 193 | |
| 194 | int64_t conv1d_output_frames(const Conv1dConfig & config, int64_t input_frames) { |
| 195 | return (input_frames + 2 * config.padding - config.dilation * (config.kernel_size - 1) - 1) / config.stride + 1; |
| 196 | } |
| 197 | bool is_conv1d_pertap_fast_path_eligible( |
| 198 | const core::ModuleBuildContext & ctx, |
| 199 | const Conv1dConfig & config, |
| 200 | const core::TensorValue & input) noexcept { |
| 201 | return ctx.backend_type == core::BackendType::Metal && |
| 202 | config.padding == 0 && |
| 203 | config.stride == 1 && |
| 204 | input.shape.dims[0] == 1 && |
| 205 | input.type == GGML_TYPE_F32 && |
| 206 | input.tensor->ne[0] == input.shape.dims[2] && |
| 207 | input.tensor->ne[1] == config.in_channels && |
| 208 | ggml_is_contiguous(input.tensor); |
| 209 | } |
no test coverage detected