Repository: pytorch
Issue: `dampening`, `maximize`, `foreach`, `differentiable` and `fused` parameter of `optim.SGD()` work with `str` values
Labels: module: optimizer,triaged

### 🐛 Describe the bug

[The doc](https://pytorch.org/docs/stable/generated/torch.optim.SGD.html) of `optim.SGD()` doesn't say that the type of `dampening`, `maximize`, `foreach`, `differentiable` and `fused` parameter is `str` as shown below:

> Parameters
> - ...
> - dampening ([float](https://docs.python.org/3/library/functions.html#float), optional) – dampening for momentum (default: 0)
> - ...
> - maximize ([bool](https://docs.python.org/3/library/functions.html#bool), optional) – maximize the objective with respect to the params, instead of minimizing (default: False)
> - foreach ([bool](https://docs.python.org/3/library/functions.html#bool), optional) – whether foreach implementation of optimizer is used. If unspecified by the user (so foreach is None), we will try to use foreach over the for-loop implementation on CUDA, since it is usually significantly more performant. Note that the foreach implementation uses ~ sizeof(params) more peak memory than the for-loop version due to the intermediates being a tensorlist vs just one tensor. If memory is prohibitive, batch fewer parameters through the optimizer at a time or switch this flag to False (default: None)
> - differentiable ([bool](https://docs.python.org/3/library/functions.html#bool), optional) – whether autograd should occur through the optimizer step in training. Otherwise, the step() function runs in a torch.no_grad() context. Setting to True can impair performance, so leave it False if you don’t intend to run autograd through this instance (default: False)
> - fused ([bool](https://docs.python.org/3/library/functions.html#bool), optional) – whether the fused implementation is used. Currently, torch.float64, torch.float32, torch.float16, and torch.bfloat16 are supported. (default: None)

But `dampening`, `maximize`, `foreach`, `differentiable` and `fused` parameter work with `str` values as shown below:

```python
from torch import nn
from torch import optim

class MyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear_layer = nn.Linear(in_features=4, out_features=5)
    
    def forward(self, x):
        return self.linear_layer(x)

mymodel = MyModel()

sgd = optim.SGD(params=mymodel.parameters(),
                dampening='Hello', maximize='Hello', 
                foreach='Hello', differentiable='Hello')
sgd
# SGD (
# Parameter Group 0
#     dampening: Hello
#     differentiable: Hello
#     foreach: Hello
#     fused: None
#     lr: 0.001
#     maximize: Hello
#     momentum: 0
#     nesterov: False
#     weight_decay: 0
# )

sgd = optim.SGD(params=mymodel.parameters(), fused='Hello')
sgd
# SGD (
# Parameter Group 0
#     dampening: 0
#     differentiable: False
#     foreach: None
#     fused: Hello
#     lr: 0.001
#     maximize: False
#     momentum: 0
#     nesterov: False
#     weight_decay: 0
# )
```

### Versions

```python
import torch

torch.__version__ # '2.3.0'
```

cc @vincentqb @jbschlosser @albanD @janeyx99 @crcrpar