| 155 | } |
| 156 | |
| 157 | core::TensorValue encoder_layer( |
| 158 | core::ModuleBuildContext & ctx, |
| 159 | const core::TensorValue & input, |
| 160 | const core::TensorValue & position_bias, |
| 161 | const core::TensorValue & additive_attention_mask, |
| 162 | const T5BaseEncoderLayerWeights & weights, |
| 163 | const T5BaseEncoderConfig & config) { |
| 164 | auto hidden = t5_layer_norm(ctx, input, weights.self_attention_layer_norm, config); |
| 165 | hidden = self_attention(ctx, hidden, position_bias, additive_attention_mask, weights, config); |
| 166 | auto output = AddModule{}.build(ctx, input, hidden); |
| 167 | hidden = t5_layer_norm(ctx, output, weights.ffn_layer_norm, config); |
| 168 | hidden = feed_forward(ctx, hidden, weights, config); |
| 169 | return AddModule{}.build(ctx, output, hidden); |
| 170 | } |
| 171 | |
| 172 | } // namespace |
| 173 |
no test coverage detected