Fix gradient clipping for Sharded DDP
# What does this PR do?

As mentioned in the discussion of #9156, `Trainer` does not do gradient clipping correctly when using a sharded optimizer. This PR fixes that, and also allows `Trainer` to not perform any gradient clipping (by passing `None` or `0` to the corresponding argument).