| 263 | |
| 264 | template<typename T> |
| 265 | void Decoding<T>::forward(std::vector<Tensor>* output_tensors, |
| 266 | const std::vector<Tensor>* input_tensors, |
| 267 | const DecodingWeight<T>* decoding_weights) |
| 268 | { |
| 269 | FT_LOG_DEBUG(__PRETTY_FUNCTION__); |
| 270 | // input_tensors: |
| 271 | // encoder_output [batch_size * beam, mem_max_seq_len, memory_hidden_dimension] |
| 272 | // encoder_sequence_length [batch_size * beam] |
| 273 | |
| 274 | // output_tensors: |
| 275 | // output_ids [max_seq_len, batch_size, beam] |
| 276 | // parent_ids [max_seq_len, batch_size, beam] |
| 277 | // sequence_length [batch_size, beam], record the number of generated token, except the start token |
| 278 | |
| 279 | // Step is from 1 ~ max_seq_len, |
| 280 | // When step = k, we put output ids and caches at step k, and the sequence_length would be k - 1 before |
| 281 | // complete this step. |
| 282 | |
| 283 | std::unordered_map<std::string, Tensor> input_tensors_map{{"encoder_output", input_tensors->at(0)}, |
| 284 | {"encoder_sequence_length", input_tensors->at(1)}}; |
| 285 | |
| 286 | std::unordered_map<std::string, Tensor> output_tensors_map{{"output_ids", output_tensors->at(0)}, |
| 287 | {"parent_ids", output_tensors->at(1)}, |
| 288 | {"sequence_length", output_tensors->at(2)}}; |
| 289 | forward(&output_tensors_map, &input_tensors_map, decoding_weights); |
| 290 | } |
| 291 | |
| 292 | template<typename T> |
| 293 | void Decoding<T>::forward(std::unordered_map<std::string, Tensor>* output_tensors, |
nothing calls this directly
no test coverage detected