enhance comparison tests for c10::optional (#62887)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/62887
Reviewed By: VitalyFedyunin
Differential Revision: D30305044
Pulled By: dagitses
fbshipit-source-id: d0a3a9e4ea186915ef087543aaf81a606f943380