Fix memory leak when going from the fast path to the slow path in eager
Fix memory leak when going from the fast path to the slow path in eager

Fixes #19385

PiperOrigin-RevId: 197607384

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