Refactor duplicated string literals (#40788)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/40788
Avoid repeated the same `:gencode[foo/bar]` over and over again
Test Plan: CI
Reviewed By: EscapeZero
Differential Revision: D22271151
fbshipit-source-id: f8db57db4ee0948bcca0c8945fdf30380ba81cae