| 2269 | } |
| 2270 | |
| 2271 | port::StatusOr<std::unique_ptr<dnn::RnnDescriptor>> |
| 2272 | CudnnSupport::createRnnDescriptor( |
| 2273 | int num_layers, int hidden_size, int input_size, int cell_size, |
| 2274 | int batch_size, dnn::RnnInputMode input_mode, |
| 2275 | dnn::RnnDirectionMode direction_mode, dnn::RnnMode rnn_mode, |
| 2276 | dnn::DataType data_type, const dnn::AlgorithmConfig& algorithm_config, |
| 2277 | float dropout, uint64 seed, ScratchAllocator* state_allocator, |
| 2278 | bool use_padded_io) { |
| 2279 | // Setting up a cudnnRNNDescriptor requires a cuDNN handle, but because it's |
| 2280 | // not enqueueing anything into a stream, we pass in the null stream. |
| 2281 | auto cudnn = cudnn_->GetHandle(parent_, /*stream=*/nullptr); |
| 2282 | SE_ASSIGN_OR_RETURN( |
| 2283 | CudnnRnnDescriptor rnn_desc, |
| 2284 | CudnnRnnDescriptor::Create( |
| 2285 | cudnn, num_layers, hidden_size, input_size, cell_size, batch_size, |
| 2286 | ToCudnnRnnInputMode(input_mode), |
| 2287 | ToCudnnRnnDirectionMode(direction_mode), ToCudnnRnnMode(rnn_mode), |
| 2288 | ToCudnnDataType(data_type), GetRnnComputeType(data_type), |
| 2289 | algorithm_config, dropout, seed, state_allocator, use_padded_io)); |
| 2290 | return std::unique_ptr<dnn::RnnDescriptor>( |
| 2291 | new CudnnRnnDescriptor(std::move(rnn_desc))); |
| 2292 | } |
| 2293 | |
| 2294 | port::StatusOr<std::unique_ptr<dnn::CtcLossDescriptor>> |
| 2295 | CudnnSupport::createCtcLossDescriptor( |