existing_grad=hsdp_param.sharded_param.gradifexisting_gradisnotNoneandnothsdp_param.accumulated_allreduced_grad:# Get DTensor's local_tensorfromhyper_parallel.core.dtensor.dtensorimportDTensorifisinstance(existing_grad,DTensor):existing_grad_local=existing_grad._local_tensorelse:existing_grad_local=existing_grad