[export] Serialize union fields with single entry dict. (#121263)
Summary: remove "$type" and "$value" fields, instead only serialize as {type: value} for union fields directly.
Test Plan: CI
Differential Revision: D54553770
Pull Request resolved: https://github.com/pytorch/pytorch/pull/121263
Approved by: https://github.com/tugsbayasgalan