| 18 | return core::wrap_tensor(ggml_cast(ctx.ggml, value.tensor, GGML_TYPE_F32), value.shape, GGML_TYPE_F32); |
| 19 | } |
| 20 | |
| 21 | core::TensorValue regular_conv_weight( |
| 22 | core::ModuleBuildContext & ctx, |
| 23 | const core::TensorValue & weight, |
| 24 | const char * module_name) { |
| 25 | const auto contiguous = tensor_layout::ensure_contiguous_layout_if_needed(ctx, weight); |
| 26 | if (contiguous.type == GGML_TYPE_F32 || contiguous.type == GGML_TYPE_F16) { |
| 27 | return contiguous; |
| 28 | } |
| 29 | if (contiguous.type == GGML_TYPE_BF16) { |
| 30 | return core::wrap_tensor(ggml_cast(ctx.ggml, contiguous.tensor, GGML_TYPE_F16), contiguous.shape, GGML_TYPE_F16); |
| 31 | } |
| 32 | if (ggml_is_quantized(contiguous.type)) { |
| 33 | return core::wrap_tensor(ggml_cast(ctx.ggml, contiguous.tensor, GGML_TYPE_F32), contiguous.shape, GGML_TYPE_F32); |
| 34 | } |
| 35 | throw std::runtime_error( |
| 36 | std::string(module_name) + " does not support weight type with the current ggml conv path: " + |
| 37 | ggml_type_name(contiguous.type)); |
| 38 | } |
| 39 | |
| 40 | int64_t depthwise_conv1d_output_frames(const DepthwiseConv1dConfig & config, int64_t input_frames) { |
no test coverage detected