Fix flakiness in caffe2/test:serialization - test_serialization_new_format_old_format_compat (#45915) (#46114)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/45915
Use temp file instead
Test Plan: buck test mode/opt-asan //caffe2/test:serialization -- 'test_serialization_new_format_old_format_compat \(test_serialization\.TestBothSerialization\)' --run-disabled --jobs 18 --stress-runs 10 --record-results
Reviewed By: malfet
Differential Revision: D24142278
fbshipit-source-id: 9c88330fc5664d464daa9124e67644f497353f3b
Co-authored-by: Rong Rong <rongr@fb.com>