[PyTorch] [Model Tracer] Use c10::Synchronized<T> for custom classes tracer (#73724)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73724
Currently, the custom classes tracer relies on the user to for advisory locking of the mutex when accessing shared data structures. This changes it to be mandatory locking using the `c10::Synchronized<T>` abstraction.
ghstack-source-id: 150407246
Test Plan:
Built model tracer successfully using:
```
buck build -c pt.disable_per_op_profiling=0 -c pt.enable_record_kernel_dtype=1 --show-output xplat/caffe2/fb/model_tracer:model_tracer
```
Reviewed By: JacobSzwejbka
Differential Revision: D34604067
fbshipit-source-id: bd2ca366fe1b2a20a56971af78404fe158a38988
(cherry picked from commit 6a63646034ab666cbac51c5f30621519324f2321)