Remove use of conitional pass-through from dynamic_rnn in favor of just
calling select() at each step. conditionals add a bunch of extra ops that slow things down; and generally the size of the input tensor into dynamic_rnn matches max_sequence_length so they provide no benefit. Before change, benchmarks: Calculation: Static Unroll with Dynamic Flow LSTM vs. Dynamic Unroll LSTM batch max_t units gpu dt(static) dt(dynamic) dt(dynamic)/dt(static) 256 50 512 False 1.795002 1.774248 0.988437 256 50 512 True 0.186828 0.200752 1.074525 256 50 256 False 0.597320 0.750226 1.255986 256 50 256 True 0.082047 0.091411 1.114130 256 50 128 False 0.250596 0.238233 0.950666 256 50 128 True 0.056480 0.063086 1.116960 After change, benchmarks: Calculation: Static Unroll with Dynamic Flow LSTM vs. Dynamic Unroll LSTM batch max_t units gpu dt(static) dt(dynamic) dt(dynamic)/dt(static) 256 50 512 False 1.723348 1.763019 1.023020 256 50 512 True 0.186794 0.196334 1.051072 256 50 256 False 0.644540 0.704506 1.093036 256 50 256 True 0.082274 0.087785 1.066985 256 50 128 False 0.241971 0.234559 0.969368 256 50 128 True 0.056356 0.059771 1.060611 Basically expect a more significant decrease in GPU step time when the matrices are smaller. Change: 117254684
Showing
想要评论请 注册 或 登录