| 41 | return (input_frames + 2 * config.padding - config.dilation * (config.kernel_size - 1) - 1) / config.stride + 1; |
| 42 | } |
| 43 | |
| 44 | core::TensorValue add_bias_bct( |
| 45 | core::ModuleBuildContext & ctx, |
| 46 | const core::TensorValue & output, |
| 47 | int64_t channels, |
| 48 | const std::optional<core::TensorValue> & bias) { |
| 49 | if (!bias.has_value()) { |
| 50 | return output; |
| 51 | } |
| 52 | auto output_contiguous = tensor_layout::ensure_contiguous_layout_if_needed(ctx, output); |
| 53 | auto bias_view = core::reshape_tensor(ctx, *bias, core::TensorShape::from_dims({1, channels, 1})); |
| 54 | auto repeated = core::wrap_tensor(ggml_repeat(ctx.ggml, bias_view.tensor, output_contiguous.tensor), output.shape, GGML_TYPE_F32); |
| 55 | return core::wrap_tensor(ggml_add(ctx.ggml, output_contiguous.tensor, repeated.tensor), output.shape, GGML_TYPE_F32); |
| 56 | } |
| 57 | |
| 58 | core::TensorValue zeros_like_prefix( |
no test coverage detected