Fixes to prim ops (#32179)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32179
Tensors are used as keys in dictionaries, so we need to annotate that key insertion into a dictionary inserts the key into the wildcard set. Also fixes bug with `listCopyAndSort` not copying the input list.
Test Plan: Imported from OSS
Differential Revision: D19397555
Pulled By: eellison
fbshipit-source-id: 17acdc22ff5e2dda44fd25c80450396f5592095e