update legacy dispatcher registration API tests to avoid duplicate def() calls (#47319)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/47319
Test Plan: Imported from OSS
Reviewed By: ezyang
Differential Revision: D24714804
Pulled By: bdhirsh
fbshipit-source-id: 4827fbb9a568a44599bb84e45cbe63b02181f21e