Handle torch.memory_format serialization in TensorProperties.
The current code deals with TensorProperties serialization in ShardedTensorMetadata,
this force using TensorProperties anywhere else to copy the serialization
workaround for torch.memory_format.
By moving the workaround to TensorProperties itself, we make the type
more modular and reusable.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76679
Approved by: https://github.com/pritamdamania87