Changed MaybeCopyInputToExpectedDevice to be CopyInputToExpectedDevice and only invoke it when the tensor isn't already on the correct device.  This allows us to avoid lots of Ref()/Unref() of tensor handles and op->UpdateInput calls that are unnecessary when no copying was done.
Changed MaybeCopyInputToExpectedDevice to be CopyInputToExpectedDevice and
only invoke it when the tensor isn't already on the correct device.  This
allows us to avoid lots of Ref()/Unref() of tensor handles and op->UpdateInput
calls that are unnecessary when no copying was done.

PiperOrigin-RevId: 267478212

arborh/tensorflow,petewarden/tensorflow,freedomtan/tensorflow,ppwwyyxx/tensorflow,Intel-tensorflow/tensorflow,yongtang/tensorflow,davidzchen/tensorflow,adit-chandra/tensorflow,annarev/tensorflow,xzturn/tensorflow,sarvex/tensorflow,xzturn/tensorflow,xzturn/tensorflow,sarvex/tensorflow,xzturn/tensorflow,jhseu/tensorflow,gautam1858/tensorflow,gunan/tensorflow,Intel-Corporation/tensorflow,annarev/tensorflow,yongtang/tensorflow,freedomtan/tensorflow,renyi533/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,xzturn/tensorflow,gunan/tensorflow,ppwwyyxx/tensorflow,Intel-Corporation/tensorflow,gunan/tensorflow,davidzchen/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gunan/tensorflow,karllessard/tensorflow,annarev/tensorflow,adit-chandra/tensorflow,renyi533/tensorflow,gunan/tensorflow,aam-at/tensorflow,cxxgtxy/tensorflow,arborh/tensorflow,tensorflow/tensorflow,DavidNorman/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,gunan/tensorflow,Intel-Corporation/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,ppwwyyxx/tensorflow,chemelnucfin/tensorflow,xzturn/tensorflow,petewarden/tensorflow,karllessard/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow,paolodedios/tensorflow,DavidNorman/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,jhseu/tensorflow,gunan/tensorflow,jhseu/tensorflow,Intel-Corporation/tensorflow,karllessard/tensorflow,arborh/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,sarvex/tensorflow,chemelnucfin/tensorflow,annarev/tensorflow,renyi533/tensorflow,petewarden/tensorflow,freedomtan/tensorflow,Intel-tensorflow/tensorflow,arborh/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,renyi533/tensorflow,jhseu/tensorflow,xzturn/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,sarvex/tensorflow,karllessard/tensorflow,petewarden/tensorflow,DavidNorman/tensorflow,paolodedios/tensorflow,annarev/tensorflow,annarev/tensorflow,ppwwyyxx/tensorflow,chemelnucfin/tensorflow,annarev/tensorflow,tensorflow/tensorflow-pywrap_saved_model,gunan/tensorflow,adit-chandra/tensorflow,yongtang/tensorflow,ppwwyyxx/tensorflow,aldian/tensorflow,aam-at/tensorflow,paolodedios/tensorflow,cxxgtxy/tensorflow,gunan/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_saved_model,davidzchen/tensorflow,davidzchen/tensorflow,jhseu/tensorflow,xzturn/tensorflow,DavidNorman/tensorflow,frreiss/tensorflow-fred,Intel-tensorflow/tensorflow,chemelnucfin/tensorflow,petewarden/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_tf_optimizer,ppwwyyxx/tensorflow,davidzchen/tensorflow,frreiss/tensorflow-fred,cxxgtxy/tensorflow,DavidNorman/tensorflow,frreiss/tensorflow-fred,adit-chandra/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,aldian/tensorflow,adit-chandra/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,arborh/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,freedomtan/tensorflow,frreiss/tensorflow-fred,aam-at/tensorflow,arborh/tensorflow,chemelnucfin/tensorflow,davidzchen/tensorflow,sarvex/tensorflow,jhseu/tensorflow,adit-chandra/tensorflow,adit-chandra/tensorflow,freedomtan/tensorflow,chemelnucfin/tensorflow,xzturn/tensorflow,freedomtan/tensorflow,chemelnucfin/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,frreiss/tensorflow-fred,freedomtan/tensorflow,adit-chandra/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-Corporation/tensorflow,frreiss/tensorflow-fred,gautam1858/tensorflow,renyi533/tensorflow,DavidNorman/tensorflow,arborh/tensorflow,aldian/tensorflow,renyi533/tensorflow,aldian/tensorflow,tensorflow/tensorflow-pywrap_saved_model,frreiss/tensorflow-fred,tensorflow/tensorflow-experimental_link_static_libraries_once,renyi533/tensorflow,jhseu/tensorflow,yongtang/tensorflow,Intel-Corporation/tensorflow,chemelnucfin/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,petewarden/tensorflow,frreiss/tensorflow-fred,chemelnucfin/tensorflow,karllessard/tensorflow,chemelnucfin/tensorflow,freedomtan/tensorflow,davidzchen/tensorflow,ppwwyyxx/tensorflow,adit-chandra/tensorflow,DavidNorman/tensorflow,jhseu/tensorflow,chemelnucfin/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow,ppwwyyxx/tensorflow,sarvex/tensorflow,tensorflow/tensorflow-pywrap_saved_model,petewarden/tensorflow,gunan/tensorflow,annarev/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,jhseu/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-pywrap_saved_model,adit-chandra/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,renyi533/tensorflow,yongtang/tensorflow,adit-chandra/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,aam-at/tensorflow,arborh/tensorflow,frreiss/tensorflow-fred,aam-at/tensorflow,karllessard/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,annarev/tensorflow,gautam1858/tensorflow,aldian/tensorflow,Intel-tensorflow/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,arborh/tensorflow,renyi533/tensorflow,davidzchen/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-tensorflow/tensorflow,sarvex/tensorflow,paolodedios/tensorflow,aam-at/tensorflow,arborh/tensorflow,frreiss/tensorflow-fred,DavidNorman/tensorflow,petewarden/tensorflow,aam-at/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,karllessard/tensorflow,paolodedios/tensorflow,gautam1858/tensorflow,yongtang/tensorflow,frreiss/tensorflow-fred,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,DavidNorman/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,petewarden/tensorflow,petewarden/tensorflow,davidzchen/tensorflow,jhseu/tensorflow,gunan/tensorflow,arborh/tensorflow,karllessard/tensorflow,gautam1858/tensorflow,petewarden/tensorflow,sarvex/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,Intel-Corporation/tensorflow,xzturn/tensorflow,freedomtan/tensorflow,annarev/tensorflow,yongtang/tensorflow,davidzchen/tensorflow,xzturn/tensorflow,jhseu/tensorflow,petewarden/tensorflow,ppwwyyxx/tensorflow,gautam1858/tensorflow,aam-at/tensorflow,davidzchen/tensorflow,annarev/tensorflow,ppwwyyxx/tensorflow,tensorflow/tensorflow,gunan/tensorflow,freedomtan/tensorflow,DavidNorman/tensorflow,renyi533/tensorflow,renyi533/tensorflow,aam-at/tensorflow,DavidNorman/tensorflow,adit-chandra/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,paolodedios/tensorflow,chemelnucfin/tensorflow,ppwwyyxx/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,DavidNorman/tensorflow,arborh/tensorflow,Intel-tensorflow/tensorflow,karllessard/tensorflow,xzturn/tensorflow,aldian/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,aldian/tensorflow,gautam1858/tensorflow,gautam1858/tensorflow,aam-at/tensorflow,tensorflow/tensorflow,ppwwyyxx/tensorflow,freedomtan/tensorflow,aldian/tensorflow,jhseu/tensorflow