Refactor shared cond_v2 and _IfGrad logic into _build_cond helper method.
Refactor shared cond_v2 and _IfGrad logic into _build_cond helper method.

PiperOrigin-RevId: 222832725

jhseu/tensorflow,xzturn/tensorflow,adit-chandra/tensorflow,ghchinoy/tensorflow,jbedorf/tensorflow,jendap/tensorflow,annarev/tensorflow,DavidNorman/tensorflow,gunan/tensorflow,yongtang/tensorflow,yongtang/tensorflow,jhseu/tensorflow,petewarden/tensorflow,ageron/tensorflow,petewarden/tensorflow,paolodedios/tensorflow,arborh/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,xzturn/tensorflow,karllessard/tensorflow,arborh/tensorflow,kevin-coder/tensorflow-fork,ghchinoy/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-experimental_link_static_libraries_once,renyi533/tensorflow,DavidNorman/tensorflow,tensorflow/tensorflow,chemelnucfin/tensorflow,jendap/tensorflow,ghchinoy/tensorflow,yongtang/tensorflow,tensorflow/tensorflow,Intel-tensorflow/tensorflow,kevin-coder/tensorflow-fork,tensorflow/tensorflow-pywrap_tf_optimizer,sarvex/tensorflow,jbedorf/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,adit-chandra/tensorflow,jhseu/tensorflow,Bismarrck/tensorflow,arborh/tensorflow,theflofly/tensorflow,karllessard/tensorflow,adit-chandra/tensorflow,Bismarrck/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,petewarden/tensorflow,alsrgv/tensorflow,sarvex/tensorflow,asimshankar/tensorflow,freedomtan/tensorflow,Intel-tensorflow/tensorflow,annarev/tensorflow,yongtang/tensorflow,annarev/tensorflow,alsrgv/tensorflow,annarev/tensorflow,aam-at/tensorflow,paolodedios/tensorflow,petewarden/tensorflow,kevin-coder/tensorflow-fork,tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,davidzchen/tensorflow,paolodedios/tensorflow,gautam1858/tensorflow,aam-at/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,ageron/tensorflow,aam-at/tensorflow,Bismarrck/tensorflow,renyi533/tensorflow,chemelnucfin/tensorflow,freedomtan/tensorflow,DavidNorman/tensorflow,chemelnucfin/tensorflow,alsrgv/tensorflow,adit-chandra/tensorflow,chemelnucfin/tensorflow,gunan/tensorflow,frreiss/tensorflow-fred,gautam1858/tensorflow,ppwwyyxx/tensorflow,gunan/tensorflow,davidzchen/tensorflow,jendap/tensorflow,xzturn/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow-pywrap_saved_model,gunan/tensorflow,gunan/tensorflow,ageron/tensorflow,davidzchen/tensorflow,ageron/tensorflow,ppwwyyxx/tensorflow,aldian/tensorflow,asimshankar/tensorflow,petewarden/tensorflow,sarvex/tensorflow,ppwwyyxx/tensorflow,renyi533/tensorflow,annarev/tensorflow,ppwwyyxx/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,paolodedios/tensorflow,jendap/tensorflow,tensorflow/tensorflow-pywrap_saved_model,gunan/tensorflow,tensorflow/tensorflow-pywrap_saved_model,freedomtan/tensorflow,chemelnucfin/tensorflow,renyi533/tensorflow,sarvex/tensorflow,asimshankar/tensorflow,hfp/tensorflow-xsmm,jendap/tensorflow,ppwwyyxx/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,jbedorf/tensorflow,freedomtan/tensorflow,DavidNorman/tensorflow,asimshankar/tensorflow,petewarden/tensorflow,ppwwyyxx/tensorflow,asimshankar/tensorflow,adit-chandra/tensorflow,theflofly/tensorflow,jendap/tensorflow,freedomtan/tensorflow,alsrgv/tensorflow,jhseu/tensorflow,alsrgv/tensorflow,jhseu/tensorflow,theflofly/tensorflow,tensorflow/tensorflow-pywrap_saved_model,freedomtan/tensorflow,Intel-Corporation/tensorflow,jhseu/tensorflow,Bismarrck/tensorflow,renyi533/tensorflow,jbedorf/tensorflow,jendap/tensorflow,arborh/tensorflow,xzturn/tensorflow,davidzchen/tensorflow,jbedorf/tensorflow,tensorflow/tensorflow,davidzchen/tensorflow,theflofly/tensorflow,paolodedios/tensorflow,renyi533/tensorflow,Intel-Corporation/tensorflow,ppwwyyxx/tensorflow,tensorflow/tensorflow,annarev/tensorflow,gautam1858/tensorflow,hfp/tensorflow-xsmm,arborh/tensorflow,Intel-Corporation/tensorflow,aam-at/tensorflow,Intel-Corporation/tensorflow,petewarden/tensorflow,tensorflow/tensorflow,karllessard/tensorflow,chemelnucfin/tensorflow,apark263/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,hfp/tensorflow-xsmm,petewarden/tensorflow,arborh/tensorflow,jhseu/tensorflow,chemelnucfin/tensorflow,aam-at/tensorflow,hfp/tensorflow-xsmm,ghchinoy/tensorflow,jhseu/tensorflow,frreiss/tensorflow-fred,Intel-Corporation/tensorflow,frreiss/tensorflow-fred,ageron/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,davidzchen/tensorflow,renyi533/tensorflow,petewarden/tensorflow,chemelnucfin/tensorflow,freedomtan/tensorflow,arborh/tensorflow,Intel-Corporation/tensorflow,arborh/tensorflow,cxxgtxy/tensorflow,aldian/tensorflow,frreiss/tensorflow-fred,Bismarrck/tensorflow,freedomtan/tensorflow,gautam1858/tensorflow,gautam1858/tensorflow,theflofly/tensorflow,DavidNorman/tensorflow,Intel-tensorflow/tensorflow,sarvex/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_saved_model,gunan/tensorflow,arborh/tensorflow,Bismarrck/tensorflow,ghchinoy/tensorflow,apark263/tensorflow,cxxgtxy/tensorflow,frreiss/tensorflow-fred,hfp/tensorflow-xsmm,ghchinoy/tensorflow,Intel-Corporation/tensorflow,ghchinoy/tensorflow,aldian/tensorflow,alsrgv/tensorflow,annarev/tensorflow,ageron/tensorflow,petewarden/tensorflow,hfp/tensorflow-xsmm,petewarden/tensorflow,yongtang/tensorflow,asimshankar/tensorflow,Bismarrck/tensorflow,jendap/tensorflow,frreiss/tensorflow-fred,xzturn/tensorflow,gunan/tensorflow,asimshankar/tensorflow,Intel-tensorflow/tensorflow,annarev/tensorflow,aam-at/tensorflow,jbedorf/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,alsrgv/tensorflow,chemelnucfin/tensorflow,ppwwyyxx/tensorflow,paolodedios/tensorflow,adit-chandra/tensorflow,frreiss/tensorflow-fred,Bismarrck/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,freedomtan/tensorflow,aldian/tensorflow,karllessard/tensorflow,apark263/tensorflow,jbedorf/tensorflow,ghchinoy/tensorflow,tensorflow/tensorflow-pywrap_saved_model,cxxgtxy/tensorflow,xzturn/tensorflow,theflofly/tensorflow,paolodedios/tensorflow,freedomtan/tensorflow,freedomtan/tensorflow,adit-chandra/tensorflow,tensorflow/tensorflow,alsrgv/tensorflow,ageron/tensorflow,yongtang/tensorflow,karllessard/tensorflow,aldian/tensorflow,chemelnucfin/tensorflow,gautam1858/tensorflow,yongtang/tensorflow,davidzchen/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,annarev/tensorflow,ghchinoy/tensorflow,adit-chandra/tensorflow,theflofly/tensorflow,renyi533/tensorflow,xzturn/tensorflow,xzturn/tensorflow,hfp/tensorflow-xsmm,frreiss/tensorflow-fred,tensorflow/tensorflow,jhseu/tensorflow,sarvex/tensorflow,jbedorf/tensorflow,ageron/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,hfp/tensorflow-xsmm,asimshankar/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gunan/tensorflow,yongtang/tensorflow,kevin-coder/tensorflow-fork,yongtang/tensorflow,Bismarrck/tensorflow,xzturn/tensorflow,DavidNorman/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,cxxgtxy/tensorflow,asimshankar/tensorflow,jhseu/tensorflow,ppwwyyxx/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,xzturn/tensorflow,frreiss/tensorflow-fred,kevin-coder/tensorflow-fork,aldian/tensorflow,arborh/tensorflow,ghchinoy/tensorflow,Intel-tensorflow/tensorflow,asimshankar/tensorflow,apark263/tensorflow,Intel-tensorflow/tensorflow,cxxgtxy/tensorflow,aam-at/tensorflow,cxxgtxy/tensorflow,DavidNorman/tensorflow,karllessard/tensorflow,petewarden/tensorflow,aam-at/tensorflow,frreiss/tensorflow-fred,karllessard/tensorflow,gunan/tensorflow,kevin-coder/tensorflow-fork,adit-chandra/tensorflow,Bismarrck/tensorflow,kevin-coder/tensorflow-fork,karllessard/tensorflow,DavidNorman/tensorflow,paolodedios/tensorflow,apark263/tensorflow,davidzchen/tensorflow,annarev/tensorflow,renyi533/tensorflow,alsrgv/tensorflow,ageron/tensorflow,jhseu/tensorflow,sarvex/tensorflow,DavidNorman/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,xzturn/tensorflow,gautam1858/tensorflow,theflofly/tensorflow,kevin-coder/tensorflow-fork,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,frreiss/tensorflow-fred,apark263/tensorflow,annarev/tensorflow,aldian/tensorflow,chemelnucfin/tensorflow,gautam1858/tensorflow,gunan/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,xzturn/tensorflow,theflofly/tensorflow,aam-at/tensorflow,ageron/tensorflow,jbedorf/tensorflow,jhseu/tensorflow,tensorflow/tensorflow,jbedorf/tensorflow,ghchinoy/tensorflow,kevin-coder/tensorflow-fork,gautam1858/tensorflow,hfp/tensorflow-xsmm,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,apark263/tensorflow,gunan/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,davidzchen/tensorflow,paolodedios/tensorflow,apark263/tensorflow,cxxgtxy/tensorflow,alsrgv/tensorflow,tensorflow/tensorflow-pywrap_saved_model,jendap/tensorflow,frreiss/tensorflow-fred,DavidNorman/tensorflow,ageron/tensorflow,jendap/tensorflow,adit-chandra/tensorflow,Intel-tensorflow/tensorflow,apark263/tensorflow,theflofly/tensorflow,ppwwyyxx/tensorflow,kevin-coder/tensorflow-fork,gautam1858/tensorflow,alsrgv/tensorflow,Bismarrck/tensorflow,apark263/tensorflow,apark263/tensorflow,DavidNorman/tensorflow,adit-chandra/tensorflow,kevin-coder/tensorflow-fork,arborh/tensorflow,tensorflow/tensorflow-pywrap_saved_model,jendap/tensorflow,theflofly/tensorflow,chemelnucfin/tensorflow,aldian/tensorflow,yongtang/tensorflow,aam-at/tensorflow,ghchinoy/tensorflow,DavidNorman/tensorflow,paolodedios/tensorflow,ppwwyyxx/tensorflow,davidzchen/tensorflow,cxxgtxy/tensorflow,ppwwyyxx/tensorflow,sarvex/tensorflow,alsrgv/tensorflow,renyi533/tensorflow,renyi533/tensorflow,Intel-tensorflow/tensorflow,gautam1858/tensorflow,Intel-Corporation/tensorflow,jbedorf/tensorflow,arborh/tensorflow,theflofly/tensorflow,davidzchen/tensorflow,aam-at/tensorflow,hfp/tensorflow-xsmm,Intel-tensorflow/tensorflow,aam-at/tensorflow,hfp/tensorflow-xsmm,tensorflow/tensorflow-experimental_link_static_libraries_once,adit-chandra/tensorflow,davidzchen/tensorflow,ageron/tensorflow,asimshankar/tensorflow,jbedorf/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow