| 522 | 0, |
| 523 | 1, |
| 524 | weights.bias.has_value(), |
| 525 | }).build(ctx, input, weights); |
| 526 | return modules::SliceModule({2, 0, output.shape.dims[2] - stride}).build(ctx, output); |
| 527 | } |
| 528 | |
| 529 | core::TensorValue prelu( |
| 530 | core::ModuleBuildContext & ctx, |
| 531 | const core::TensorValue & input, |
| 532 | const HeartCodecPreluWeights & weights) { |
| 533 | auto positive = core::wrap_tensor(ggml_relu(ctx.ggml, core::ensure_backend_addressable_layout(ctx, input).tensor), input.shape, GGML_TYPE_F32); |
| 534 | auto negative = core::wrap_tensor(ggml_sub(ctx.ggml, input.tensor, positive.tensor), input.shape, GGML_TYPE_F32); |
| 535 | auto alpha = core::reshape_tensor(ctx, weights.weight, core::TensorShape::from_dims({1, 1, 1})); |
| 536 | auto alpha_rep = core::wrap_tensor(ggml_repeat(ctx.ggml, alpha.tensor, input.tensor), input.shape, GGML_TYPE_F32); |
| 537 | return modules::AddModule{}.build(ctx, positive, modules::MulModule{}.build(ctx, negative, alpha_rep)); |
| 538 | } |
| 539 | |
| 540 | core::TensorValue adjacent_repeat_frames_bct( |
| 541 | core::ModuleBuildContext & ctx, |
| 542 | const core::TensorValue & input, |
| 543 | int64_t repeat) { |
| 544 | auto btc = modules::TransposeModule({{0, 2, 1}, 3}).build(ctx, input); |
| 545 | btc = core::ensure_backend_addressable_layout(ctx, btc); |
| 546 | auto bt1c = core::reshape_tensor( |
no test coverage detected