| 232 | const core::TensorValue & hidden_btc, |
| 233 | const HubertEncoderWeights & weights, |
| 234 | int64_t layer_index) { |
| 235 | const auto & config = weights.config; |
| 236 | const std::string prefix = "encoder.layers." + std::to_string(layer_index) + ".feed_forward"; |
| 237 | auto x = LinearModule({config.hidden_size, config.intermediate_size, true, GGML_PREC_F32}) |
| 238 | .build(ctx, hidden_btc, linear_weights(weights, prefix + ".intermediate_dense")); |
| 239 | x = GeluModule({GeluApproximation::ExactErf}).build(ctx, x); |
| 240 | return LinearModule({config.intermediate_size, config.hidden_size, true, GGML_PREC_F32}) |
| 241 | .build(ctx, x, linear_weights(weights, prefix + ".output_dense")); |
| 242 | } |
| 243 | |
| 244 | core::TensorValue build_hubert_graph( |
| 245 | core::ModuleBuildContext & ctx, |
| 246 | const core::TensorValue & input_values, |
| 247 | const HubertEncoderWeights & weights) { |
| 248 | const auto & config = weights.config; |
| 249 | auto hidden = core::reshape_tensor( |
no test coverage detected