[tensorboard] Remove dependence on torch.onnx (#82628)
### Description
<!-- What did you change and why was it needed? -->
The `graph` function takes a dependency on `torch.onnx.select_model_mode_for_export`, which was used because it implicitly patches `torch._C.Node` to allow for key access. This change removed the need for the patch and decoupled the tensorboard util from `torch.onnx`.
This is needed to unblock #82511 because we are removing the monkey patch
### Issue
<!-- Link to Issue ticket or RFP -->
### Testing
<!-- How did you test your change? -->
cc @ezyang @orionr @BowenBao
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82628
Approved by: https://github.com/ezyang