Fix `special_math_ops._transpose_if_necessary()` for Python 3.x.
Fix `special_math_ops._transpose_if_necessary()` for Python 3.x.

We were comparing the list of permutation indices to `range(len(perm))`, to avoid unnecessary transposes. On Python 2.x, this is a list, which means the equality comparison has the desired effect. On Python 3.x it is a range iterator, and the equality check fails, creating unnecessary transposes for users of `tf.einsum()`.

PiperOrigin-RevId: 259131715

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