| 704 | int64_t groups, |
| 705 | const std::vector<core::TensorValue> * stage_time_masks, |
| 706 | const std::vector<core::TensorValue> * stage_inv_valid_group_values) { |
| 707 | auto x = input_bct; |
| 708 | for (size_t index = 0; index < weights.stages.size(); ++index) { |
| 709 | const auto & stage = weights.stages[index]; |
| 710 | x = conv_transpose1d_with_padding(ctx, x, stage.upsample); |
| 711 | if (stage_time_masks != nullptr) { |
| 712 | x = mask_bct(ctx, x, (*stage_time_masks)[index]); |
| 713 | } |
| 714 | x = snake_beta(ctx, x, stage.snake); |
| 715 | if (stage_time_masks != nullptr) { |
| 716 | x = mask_bct(ctx, x, (*stage_time_masks)[index]); |
| 717 | } |
| 718 | x = resnet_block( |
| 719 | ctx, |
| 720 | x, |
| 721 | stage.resnet, |
| 722 | std::min<int64_t>(groups, x.shape.dims[1]), |
| 723 | stage_time_masks != nullptr ? std::optional<core::TensorValue>((*stage_time_masks)[index]) : std::nullopt, |
| 724 | stage_inv_valid_group_values != nullptr ? std::optional<core::TensorValue>((*stage_inv_valid_group_values)[index]) : std::nullopt); |
| 725 | } |
| 726 | x = engine::modules::TransposeModule({{0, 2, 1, 3}, x.shape.rank}).build(ctx, x); |
| 727 | x = engine::modules::LinearModule( |
| 728 | {weights.output_projection.weight.shape.dims[1], |
| 729 | weights.output_projection.weight.shape.dims[0], |
| 730 | weights.output_projection.bias.has_value()}).build( |
| 731 | ctx, |
| 732 | x, |
| 733 | weights.output_projection); |
| 734 | x = snake_beta( |
| 735 | ctx, |
| 736 | engine::modules::TransposeModule({{0, 2, 1, 3}, x.shape.rank}).build(ctx, x), |
| 737 | weights.output_snake); |
| 738 | if (stage_time_masks != nullptr && !stage_time_masks->empty()) { |
| 739 | x = mask_bct(ctx, x, stage_time_masks->back()); |
| 740 | } |
| 741 | return engine::modules::TransposeModule({{0, 2, 1, 3}, x.shape.rank}).build(ctx, x); |
| 742 | } |
| 743 | |
| 744 | } // namespace engine::models::miocodec::graphs |
no test coverage detected