| 563 | } |
| 564 | |
| 565 | core::TensorValue convnext_block( |
| 566 | core::ModuleBuildContext & ctx, |
| 567 | const core::TensorValue & input_bct, |
| 568 | const MioCodecConvNeXtBlockWeights & weights) { |
| 569 | auto x = engine::modules::DepthwiseConv1dModule(weights.depthwise_conv_config).build(ctx, input_bct, weights.depthwise_conv); |
| 570 | x = engine::modules::TransposeModule({{0, 2, 1, 3}, x.shape.rank}).build(ctx, x); |
| 571 | x = engine::modules::LayerNormModule({384, 1.0e-6F, true, true}).build(ctx, x, weights.norm); |
| 572 | x = engine::modules::LinearModule({384, 1152, weights.pointwise_conv1.bias.has_value()}).build( |
| 573 | ctx, |
| 574 | x, |
| 575 | weights.pointwise_conv1); |
| 576 | x = engine::modules::GeluModule({engine::modules::GeluApproximation::ExactErf}).build(ctx, x); |
| 577 | x = engine::modules::LinearModule({1152, 384, weights.pointwise_conv2.bias.has_value()}).build( |
| 578 | ctx, |
| 579 | x, |
| 580 | weights.pointwise_conv2); |
| 581 | x = engine::modules::TransposeModule({{0, 2, 1, 3}, x.shape.rank}).build(ctx, x); |
| 582 | x = apply_gamma(ctx, x, weights.gamma, 384); |
| 583 | return engine::modules::ResidualAddModule{}.build(ctx, input_bct, x); |
| 584 | } |
| 585 | |
| 586 | core::TensorValue global_encoder( |
| 587 | core::ModuleBuildContext & ctx, |
no test coverage detected