Modify dynamic_rnn to use max_seq_length for its while_loop.
Modify dynamic_rnn to use max_seq_length for its while_loop.

This is especially important with XLA compilation, which will usually have
a maximum time dimension on the input that is (sometimes much larger than)
max(sequence_length).  In these cases, a lot of compute can be saved.

PiperOrigin-RevId: 183148831

jart/tensorflow,jalexvig/tensorflow,arborh/tensorflow,arborh/tensorflow,AnishShah/tensorflow,adit-chandra/tensorflow,rabipanda/tensorflow,yanchen036/tensorflow,arborh/tensorflow,gojira/tensorflow,alshedivat/tensorflow,sarvex/tensorflow,adit-chandra/tensorflow,zasdfgbnm/tensorflow,Bismarrck/tensorflow,annarev/tensorflow,ravindrapanda/tensorflow,DavidNorman/tensorflow,zasdfgbnm/tensorflow,nolanliou/tensorflow,freedomtan/tensorflow,hfp/tensorflow-xsmm,theflofly/tensorflow,gojira/tensorflow,sarvex/tensorflow,davidzchen/tensorflow,allenlavoie/tensorflow,theflofly/tensorflow,Xeralux/tensorflow,nburn42/tensorflow,dendisuhubdy/tensorflow,apark263/tensorflow,yongtang/tensorflow,jart/tensorflow,aam-at/tensorflow,allenlavoie/tensorflow,AnishShah/tensorflow,kobejean/tensorflow,chemelnucfin/tensorflow,aldian/tensorflow,lukeiwanski/tensorflow,petewarden/tensorflow,allenlavoie/tensorflow,gunan/tensorflow,xodus7/tensorflow,drpngx/tensorflow,kevin-coder/tensorflow-fork,jbedorf/tensorflow,Intel-Corporation/tensorflow,lukeiwanski/tensorflow,girving/tensorflow,ageron/tensorflow,snnn/tensorflow,ageron/tensorflow,nburn42/tensorflow,brchiu/tensorflow,ZhangXinNan/tensorflow,Xeralux/tensorflow,aselle/tensorflow,DavidNorman/tensorflow,girving/tensorflow,ppwwyyxx/tensorflow,jendap/tensorflow,alshedivat/tensorflow,allenlavoie/tensorflow,adit-chandra/tensorflow,gojira/tensorflow,meteorcloudy/tensorflow,cxxgtxy/tensorflow,dongjoon-hyun/tensorflow,av8ramit/tensorflow,aldian/tensorflow,girving/tensorflow,hfp/tensorflow-xsmm,tensorflow/tensorflow-experimental_link_static_libraries_once,ppwwyyxx/tensorflow,xodus7/tensorflow,frreiss/tensorflow-fred,renyi533/tensorflow,tensorflow/tensorflow,Bismarrck/tensorflow,alsrgv/tensorflow,Intel-tensorflow/tensorflow,apark263/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gunan/tensorflow,davidzchen/tensorflow,jhseu/tensorflow,jhseu/tensorflow,arborh/tensorflow,chemelnucfin/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow,cxxgtxy/tensorflow,AnishShah/tensorflow,allenlavoie/tensorflow,jhseu/tensorflow,lukeiwanski/tensorflow,ZhangXinNan/tensorflow,petewarden/tensorflow,benoitsteiner/tensorflow-xsmm,kobejean/tensorflow,caisq/tensorflow,gautam1858/tensorflow,arborh/tensorflow,Xeralux/tensorflow,snnn/tensorflow,Intel-Corporation/tensorflow,kevin-coder/tensorflow-fork,aselle/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,drpngx/tensorflow,gautam1858/tensorflow,chemelnucfin/tensorflow,meteorcloudy/tensorflow,benoitsteiner/tensorflow-xsmm,dongjoon-hyun/tensorflow,gautam1858/tensorflow,jhseu/tensorflow,davidzchen/tensorflow,adit-chandra/tensorflow,aam-at/tensorflow,ZhangXinNan/tensorflow,av8ramit/tensorflow,nburn42/tensorflow,rabipanda/tensorflow,av8ramit/tensorflow,gautam1858/tensorflow,gautam1858/tensorflow,girving/tensorflow,gunan/tensorflow,sarvex/tensorflow,Xeralux/tensorflow,ghchinoy/tensorflow,gautam1858/tensorflow,zasdfgbnm/tensorflow,frreiss/tensorflow-fred,gunan/tensorflow,ghchinoy/tensorflow,nburn42/tensorflow,jalexvig/tensorflow,eaplatanios/tensorflow,aam-at/tensorflow,asimshankar/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,dongjoon-hyun/tensorflow,eaplatanios/tensorflow,jart/tensorflow,ravindrapanda/tensorflow,dancingdan/tensorflow,meteorcloudy/tensorflow,xodus7/tensorflow,ppwwyyxx/tensorflow,brchiu/tensorflow,kevin-coder/tensorflow-fork,ghchinoy/tensorflow,ageron/tensorflow,ghchinoy/tensorflow,zasdfgbnm/tensorflow,xzturn/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,freedomtan/tensorflow,ppwwyyxx/tensorflow,ppwwyyxx/tensorflow,dancingdan/tensorflow,jbedorf/tensorflow,cxxgtxy/tensorflow,theflofly/tensorflow,kobejean/tensorflow,apark263/tensorflow,freedomtan/tensorflow,eaplatanios/tensorflow,DavidNorman/tensorflow,gunan/tensorflow,manipopopo/tensorflow,Bismarrck/tensorflow,allenlavoie/tensorflow,rabipanda/tensorflow,frreiss/tensorflow-fred,Intel-tensorflow/tensorflow,sarvex/tensorflow,seanli9jan/tensorflow,arborh/tensorflow,nolanliou/tensorflow,alshedivat/tensorflow,freedomtan/tensorflow,aselle/tensorflow,annarev/tensorflow,ageron/tensorflow,dancingdan/tensorflow,annarev/tensorflow,chemelnucfin/tensorflow,jbedorf/tensorflow,dendisuhubdy/tensorflow,cxxgtxy/tensorflow,gunan/tensorflow,hfp/tensorflow-xsmm,jbedorf/tensorflow,brchiu/tensorflow,Bismarrck/tensorflow,zasdfgbnm/tensorflow,yanchen036/tensorflow,alsrgv/tensorflow,seanli9jan/tensorflow,frreiss/tensorflow-fred,ageron/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,zasdfgbnm/tensorflow,hehongliang/tensorflow,Intel-tensorflow/tensorflow,DavidNorman/tensorflow,girving/tensorflow,Xeralux/tensorflow,meteorcloudy/tensorflow,theflofly/tensorflow,asimshankar/tensorflow,drpngx/tensorflow,ghchinoy/tensorflow,gunan/tensorflow,xzturn/tensorflow,ppwwyyxx/tensorflow,petewarden/tensorflow,dongjoon-hyun/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,jalexvig/tensorflow,girving/tensorflow,benoitsteiner/tensorflow-xsmm,cxxgtxy/tensorflow,davidzchen/tensorflow,AnishShah/tensorflow,lukeiwanski/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,dongjoon-hyun/tensorflow,kobejean/tensorflow,asimshankar/tensorflow,snnn/tensorflow,dancingdan/tensorflow,ravindrapanda/tensorflow,seanli9jan/tensorflow,kobejean/tensorflow,petewarden/tensorflow,Intel-Corporation/tensorflow,cxxgtxy/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,drpngx/tensorflow,paolodedios/tensorflow,xzturn/tensorflow,girving/tensorflow,jart/tensorflow,gojira/tensorflow,Bismarrck/tensorflow,hfp/tensorflow-xsmm,Bismarrck/tensorflow,eaplatanios/tensorflow,annarev/tensorflow,yongtang/tensorflow,alshedivat/tensorflow,asimshankar/tensorflow,kevin-coder/tensorflow-fork,tensorflow/tensorflow-pywrap_saved_model,aselle/tensorflow,DavidNorman/tensorflow,Bismarrck/tensorflow,arborh/tensorflow,petewarden/tensorflow,yanchen036/tensorflow,alshedivat/tensorflow,yanchen036/tensorflow,nburn42/tensorflow,benoitsteiner/tensorflow-xsmm,xzturn/tensorflow,jart/tensorflow,karllessard/tensorflow,aldian/tensorflow,DavidNorman/tensorflow,jendap/tensorflow,arborh/tensorflow,asimshankar/tensorflow,ageron/tensorflow,rabipanda/tensorflow,jendap/tensorflow,nburn42/tensorflow,renyi533/tensorflow,Bismarrck/tensorflow,jalexvig/tensorflow,chemelnucfin/tensorflow,chemelnucfin/tensorflow,jart/tensorflow,frreiss/tensorflow-fred,gunan/tensorflow,karllessard/tensorflow,jalexvig/tensorflow,theflofly/tensorflow,av8ramit/tensorflow,renyi533/tensorflow,tensorflow/tensorflow,Intel-Corporation/tensorflow,ravindrapanda/tensorflow,kobejean/tensorflow,allenlavoie/tensorflow,yongtang/tensorflow,kevin-coder/tensorflow-fork,hehongliang/tensorflow,brchiu/tensorflow,chemelnucfin/tensorflow,kevin-coder/tensorflow-fork,tensorflow/tensorflow,meteorcloudy/tensorflow,AnishShah/tensorflow,benoitsteiner/tensorflow-xsmm,petewarden/tensorflow,jbedorf/tensorflow,aldian/tensorflow,adit-chandra/tensorflow,alshedivat/tensorflow,seanli9jan/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,jalexvig/tensorflow,yongtang/tensorflow,xodus7/tensorflow,theflofly/tensorflow,ZhangXinNan/tensorflow,snnn/tensorflow,freedomtan/tensorflow,apark263/tensorflow,davidzchen/tensorflow,frreiss/tensorflow-fred,kobejean/tensorflow,aldian/tensorflow,alsrgv/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,nburn42/tensorflow,jalexvig/tensorflow,chemelnucfin/tensorflow,aldian/tensorflow,frreiss/tensorflow-fred,gunan/tensorflow,jhseu/tensorflow,brchiu/tensorflow,aselle/tensorflow,av8ramit/tensorflow,Intel-tensorflow/tensorflow,hfp/tensorflow-xsmm,ravindrapanda/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,renyi533/tensorflow,theflofly/tensorflow,snnn/tensorflow,xzturn/tensorflow,karllessard/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,aam-at/tensorflow,freedomtan/tensorflow,ZhangXinNan/tensorflow,chemelnucfin/tensorflow,sarvex/tensorflow,DavidNorman/tensorflow,girving/tensorflow,tensorflow/tensorflow,brchiu/tensorflow,tensorflow/tensorflow,dendisuhubdy/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,snnn/tensorflow,annarev/tensorflow,ppwwyyxx/tensorflow,tensorflow/tensorflow-pywrap_saved_model,gautam1858/tensorflow,ageron/tensorflow,Xeralux/tensorflow,aam-at/tensorflow,alsrgv/tensorflow,av8ramit/tensorflow,drpngx/tensorflow,manipopopo/tensorflow,ageron/tensorflow,paolodedios/tensorflow,eaplatanios/tensorflow,jendap/tensorflow,benoitsteiner/tensorflow-xsmm,nburn42/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,ageron/tensorflow,davidzchen/tensorflow,ZhangXinNan/tensorflow,nolanliou/tensorflow,rabipanda/tensorflow,Intel-tensorflow/tensorflow,ghchinoy/tensorflow,av8ramit/tensorflow,yongtang/tensorflow,dancingdan/tensorflow,xodus7/tensorflow,alshedivat/tensorflow,dancingdan/tensorflow,kevin-coder/tensorflow-fork,hfp/tensorflow-xsmm,renyi533/tensorflow,tensorflow/tensorflow-pywrap_saved_model,av8ramit/tensorflow,kobejean/tensorflow,chemelnucfin/tensorflow,apark263/tensorflow,freedomtan/tensorflow,hehongliang/tensorflow,snnn/tensorflow,xodus7/tensorflow,jbedorf/tensorflow,jhseu/tensorflow,jbedorf/tensorflow,petewarden/tensorflow,ravindrapanda/tensorflow,dongjoon-hyun/tensorflow,DavidNorman/tensorflow,dongjoon-hyun/tensorflow,adit-chandra/tensorflow,kobejean/tensorflow,seanli9jan/tensorflow,yongtang/tensorflow,gojira/tensorflow,AnishShah/tensorflow,hfp/tensorflow-xsmm,Xeralux/tensorflow,hehongliang/tensorflow,arborh/tensorflow,yanchen036/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,AnishShah/tensorflow,jendap/tensorflow,drpngx/tensorflow,manipopopo/tensorflow,renyi533/tensorflow,gojira/tensorflow,seanli9jan/tensorflow,petewarden/tensorflow,yanchen036/tensorflow,seanli9jan/tensorflow,davidzchen/tensorflow,annarev/tensorflow,jendap/tensorflow,alsrgv/tensorflow,brchiu/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-pywrap_saved_model,xzturn/tensorflow,Xeralux/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_saved_model,xzturn/tensorflow,dancingdan/tensorflow,gautam1858/tensorflow,zasdfgbnm/tensorflow,benoitsteiner/tensorflow-xsmm,av8ramit/tensorflow,ghchinoy/tensorflow,yongtang/tensorflow,girving/tensorflow,dancingdan/tensorflow,dancingdan/tensorflow,Intel-Corporation/tensorflow,sarvex/tensorflow,paolodedios/tensorflow,dendisuhubdy/tensorflow,Xeralux/tensorflow,zasdfgbnm/tensorflow,DavidNorman/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,drpngx/tensorflow,karllessard/tensorflow,renyi533/tensorflow,caisq/tensorflow,zasdfgbnm/tensorflow,arborh/tensorflow,freedomtan/tensorflow,eaplatanios/tensorflow,theflofly/tensorflow,paolodedios/tensorflow,meteorcloudy/tensorflow,caisq/tensorflow,ppwwyyxx/tensorflow,ravindrapanda/tensorflow,dongjoon-hyun/tensorflow,hehongliang/tensorflow,Bismarrck/tensorflow,tensorflow/tensorflow-pywrap_saved_model,rabipanda/tensorflow,frreiss/tensorflow-fred,renyi533/tensorflow,alsrgv/tensorflow,av8ramit/tensorflow,alsrgv/tensorflow,adit-chandra/tensorflow,annarev/tensorflow,jart/tensorflow,jbedorf/tensorflow,Intel-Corporation/tensorflow,ZhangXinNan/tensorflow,apark263/tensorflow,seanli9jan/tensorflow,aselle/tensorflow,DavidNorman/tensorflow,lukeiwanski/tensorflow,nolanliou/tensorflow,xodus7/tensorflow,yongtang/tensorflow,karllessard/tensorflow,annarev/tensorflow,allenlavoie/tensorflow,apark263/tensorflow,asimshankar/tensorflow,aam-at/tensorflow,yanchen036/tensorflow,jendap/tensorflow,xodus7/tensorflow,xzturn/tensorflow,aselle/tensorflow,rabipanda/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,caisq/tensorflow,yongtang/tensorflow,manipopopo/tensorflow,dendisuhubdy/tensorflow,jbedorf/tensorflow,lukeiwanski/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,alsrgv/tensorflow,gautam1858/tensorflow,adit-chandra/tensorflow,ghchinoy/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,allenlavoie/tensorflow,dendisuhubdy/tensorflow,freedomtan/tensorflow,alsrgv/tensorflow,aam-at/tensorflow,meteorcloudy/tensorflow,paolodedios/tensorflow,AnishShah/tensorflow,tensorflow/tensorflow,seanli9jan/tensorflow,ppwwyyxx/tensorflow,karllessard/tensorflow,sarvex/tensorflow,tensorflow/tensorflow,aam-at/tensorflow,dendisuhubdy/tensorflow,jalexvig/tensorflow,arborh/tensorflow,dongjoon-hyun/tensorflow,renyi533/tensorflow,nburn42/tensorflow,ppwwyyxx/tensorflow,gunan/tensorflow,frreiss/tensorflow-fred,ghchinoy/tensorflow,gojira/tensorflow,manipopopo/tensorflow,theflofly/tensorflow,ghchinoy/tensorflow,caisq/tensorflow,jendap/tensorflow,gunan/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,xzturn/tensorflow,adit-chandra/tensorflow,DavidNorman/tensorflow,snnn/tensorflow,seanli9jan/tensorflow,girving/tensorflow,seanli9jan/tensorflow,hfp/tensorflow-xsmm,ZhangXinNan/tensorflow,jbedorf/tensorflow,zasdfgbnm/tensorflow,Intel-Corporation/tensorflow,jart/tensorflow,jendap/tensorflow,xzturn/tensorflow,tensorflow/tensorflow-pywrap_saved_model,hfp/tensorflow-xsmm,dendisuhubdy/tensorflow,aselle/tensorflow,drpngx/tensorflow,annarev/tensorflow,nburn42/tensorflow,gojira/tensorflow,DavidNorman/tensorflow,sarvex/tensorflow,rabipanda/tensorflow,petewarden/tensorflow,alsrgv/tensorflow,snnn/tensorflow,snnn/tensorflow,adit-chandra/tensorflow,gunan/tensorflow,davidzchen/tensorflow,manipopopo/tensorflow,Bismarrck/tensorflow,alsrgv/tensorflow,ppwwyyxx/tensorflow,karllessard/tensorflow,lukeiwanski/tensorflow,aldian/tensorflow,benoitsteiner/tensorflow-xsmm,kevin-coder/tensorflow-fork,manipopopo/tensorflow,yanchen036/tensorflow,rabipanda/tensorflow,frreiss/tensorflow-fred,ravindrapanda/tensorflow,brchiu/tensorflow,jalexvig/tensorflow,brchiu/tensorflow,meteorcloudy/tensorflow,cxxgtxy/tensorflow,nolanliou/tensorflow,drpngx/tensorflow,tensorflow/tensorflow,caisq/tensorflow,davidzchen/tensorflow,eaplatanios/tensorflow,freedomtan/tensorflow,dancingdan/tensorflow,ageron/tensorflow,freedomtan/tensorflow,aselle/tensorflow,asimshankar/tensorflow,aam-at/tensorflow,apark263/tensorflow,caisq/tensorflow,caisq/tensorflow,ghchinoy/tensorflow,lukeiwanski/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,dongjoon-hyun/tensorflow,xodus7/tensorflow,AnishShah/tensorflow,annarev/tensorflow,alshedivat/tensorflow,paolodedios/tensorflow,jalexvig/tensorflow,karllessard/tensorflow,benoitsteiner/tensorflow-xsmm,manipopopo/tensorflow,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tensorflow,eaplatanios/tensorflow,kobejean/tensorflow,kevin-coder/tensorflow-fork,nburn42/tensorflow,adit-chandra/tensorflow,dendisuhubdy/tensorflow,Intel-tensorflow/tensorflow,xzturn/tensorflow,caisq/tensorflow,zasdfgbnm/tensorflow,jhseu/tensorflow,theflofly/tensorflow,renyi533/tensorflow,asimshankar/tensorflow,nolanliou/tensorflow,AnishShah/tensorflow,jhseu/tensorflow,jendap/tensorflow,kevin-coder/tensorflow-fork,nolanliou/tensorflow,tensorflow/tensorflow,aselle/tensorflow,gojira/tensorflow,petewarden/tensorflow,theflofly/tensorflow,Intel-Corporation/tensorflow,chemelnucfin/tensorflow,aam-at/tensorflow,hehongliang/tensorflow,eaplatanios/tensorflow,rabipanda/tensorflow,allenlavoie/tensorflow,eaplatanios/tensorflow,ghchinoy/tensorflow,hfp/tensorflow-xsmm,davidzchen/tensorflow,karllessard/tensorflow,gojira/tensorflow,theflofly/tensorflow,apark263/tensorflow,xodus7/tensorflow,yongtang/tensorflow,jhseu/tensorflow,av8ramit/tensorflow,hfp/tensorflow-xsmm,aam-at/tensorflow,jbedorf/tensorflow,annarev/tensorflow,paolodedios/tensorflow,brchiu/tensorflow,petewarden/tensorflow,jhseu/tensorflow,frreiss/tensorflow-fred,kobejean/tensorflow,Intel-tensorflow/tensorflow,aldian/tensorflow,nolanliou/tensorflow,alshedivat/tensorflow,renyi533/tensorflow,tensorflow/tensorflow,aselle/tensorflow,brchiu/tensorflow,gojira/tensorflow,aam-at/tensorflow,ageron/tensorflow,ZhangXinNan/tensorflow,ravindrapanda/tensorflow,hehongliang/tensorflow,dendisuhubdy/tensorflow,manipopopo/tensorflow,frreiss/tensorflow-fred,karllessard/tensorflow,allenlavoie/tensorflow,Intel-tensorflow/tensorflow,benoitsteiner/tensorflow-xsmm,alshedivat/tensorflow,eaplatanios/tensorflow,arborh/tensorflow,manipopopo/tensorflow,jart/tensorflow,AnishShah/tensorflow,ageron/tensorflow,dongjoon-hyun/tensorflow,Bismarrck/tensorflow,alshedivat/tensorflow,meteorcloudy/tensorflow,Xeralux/tensorflow,ZhangXinNan/tensorflow,girving/tensorflow,adit-chandra/tensorflow,karllessard/tensorflow,asimshankar/tensorflow,jhseu/tensorflow,asimshankar/tensorflow,nolanliou/tensorflow,meteorcloudy/tensorflow,gautam1858/tensorflow,nolanliou/tensorflow,ZhangXinNan/tensorflow,benoitsteiner/tensorflow-xsmm,jalexvig/tensorflow,xodus7/tensorflow,paolodedios/tensorflow,paolodedios/tensorflow,alsrgv/tensorflow,jart/tensorflow,Xeralux/tensorflow,lukeiwanski/tensorflow,dancingdan/tensorflow,davidzchen/tensorflow,caisq/tensorflow,jendap/tensorflow,ppwwyyxx/tensorflow,jhseu/tensorflow,xzturn/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,asimshankar/tensorflow,kevin-coder/tensorflow-fork,apark263/tensorflow,lukeiwanski/tensorflow,petewarden/tensorflow,snnn/tensorflow,apark263/tensorflow,jbedorf/tensorflow,manipopopo/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-pywrap_saved_model,drpngx/tensorflow,rabipanda/tensorflow,chemelnucfin/tensorflow