Address string attribute issue (#28494)
This pull request improves support for string tensor attributes in the
Common Subexpression Elimination (CSE) optimizer, ensuring correct
handling and hashing of nodes with string tensor attributes and adding a
regression test to prevent regressions. The most important changes are:
**Bug Fixes and Feature Support:**
* Updated `AreScalarTensorAttributeEqual` in
`common_subexpression_elimination.cc` to correctly handle and compare
scalar string tensor attributes, removing the restriction that
previously excluded string tensors.
* Modified `GetTensorAttributeHash` in
`common_subexpression_elimination.cc` to support hashing of string
tensor attributes, removing the enforcement that string tensors are not
expected and ensuring string data is included in the hash.
**Testing and Regression Prevention:**
* Added a regression test `StringTensorAttr` in `cse_test.cc` to verify
that CSE does support nodes with string tensor attributes, specifically
testing with `LabelEncoder` nodes that retain their string tensor
attributes.
---------
Co-authored-by: Rajat Monga <rajatmonga_microsoft@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rajatmonga <15679194+rajatmonga@users.noreply.github.com>