[TensorBoard] fix #33140 (#36497)
Summary:
cc orionr sanekmelnikov
The fix was ported from https://github.com/lanpa/tensorboardX/commit/9d267066a6d67991ad8263c3a4f4a8c570367c53
Pull Request resolved: https://github.com/pytorch/pytorch/pull/36497
Differential Revision: D21002710
Pulled By: natalialunova
fbshipit-source-id: 0d2f3697c650bccdf6de52583de0d38c5c219261