| 770 | } |
| 771 | |
| 772 | core::TensorValue graph_run_dual_encoder( |
| 773 | core::ModuleBuildContext & ctx, |
| 774 | std::vector<GraphConstant> & constants, |
| 775 | core::TensorValue x, |
| 776 | const std::unordered_map<std::string, Param> & params, |
| 777 | const std::string & root) { |
| 778 | const int64_t frames = x.shape.dims[2]; |
| 779 | const int64_t freq = x.shape.dims[3]; |
| 780 | auto f_in = graph_transpose(ctx, x, {{3, 2, 0, 1}}, 4); |
| 781 | f_in = graph_reshape(ctx, f_in, core::TensorShape::from_dims({freq, frames, kDense})); |
| 782 | auto f_out = graph_zipformer_layer(ctx, constants, f_in, params, root + ".f_layers.0"); |
| 783 | f_out = graph_bypass(ctx, f_in, f_out, require_param(params, root + ".bypass_layers.0.bypass_scale")); |
| 784 | x = graph_reshape(ctx, f_out, core::TensorShape::from_dims({freq, frames, 1, kDense})); |
| 785 | x = graph_transpose(ctx, x, {{2, 3, 1, 0}}, 4); |
| 786 | |
| 787 | auto t_in = graph_transpose(ctx, x, {{2, 3, 0, 1}}, 4); |
| 788 | t_in = graph_reshape(ctx, t_in, core::TensorShape::from_dims({frames, freq, kDense})); |
| 789 | auto t_out = graph_zipformer_layer(ctx, constants, t_in, params, root + ".t_layers.0"); |
| 790 | t_out = graph_bypass(ctx, t_in, t_out, require_param(params, root + ".bypass_layers.1.bypass_scale")); |
| 791 | x = graph_reshape(ctx, t_out, core::TensorShape::from_dims({frames, freq, 1, kDense})); |
| 792 | return graph_transpose(ctx, x, {{2, 3, 0, 1}}, 4); |
| 793 | } |
| 794 | |
| 795 | core::TensorValue graph_run_downsampled_encoder( |
| 796 | core::ModuleBuildContext & ctx, |
no test coverage detected