Fix bug in generic_list_compare (#94156)
https://github.com/pytorch/pytorch/pull/94054 introduced a bug in list
comparisons other than `==`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94156
Approved by: https://github.com/voznesenskym