[sharded_tensor] add new init_from_local_shards API (#60479)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/60479
This added `init_from_local_shards` API to construct a ShardedTensor from local_shards and global sharded_tensor_metadata. It also refactors the utils in ShardingSpec to be able to be used by sharded_tensor for sanity check purpose.
Test Plan:
test_init_from_local_shards
test_init_from_local_shards_invalid_sharding
Reviewed By: pritamdamania87
Differential Revision: D29276777
fbshipit-source-id: 011c1d70426bc560a59b8d858c68f1aa12db8481