[FSDP][state_dict] Return tensors instead of FlatParameters to avoid pickling errors (#94637)
After https://github.com/pytorch/pytorch/pull/88913, user-defined parameter states will be pickled. For a FlatParameter, this means `_local_shard` will also be pickled. Since state_dict and load_state_dict only require the tensor, returning the full FlatParameter does not give us any extra benefit. This PR changes the behavior to simply return a view of the FlatParameter.
Differential Revision: [D43205127](https://our.internmc.facebook.com/intern/diff/D43205127/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94637
Approved by: https://github.com/rohan-varma