shirui-japina:

we have to set batch_size and its value can not be 1


This statement is not true, e.g. 1 is a default batch_size of torch.utils.data.DataLoader. So to get “true” SGD, you are free to use 1 as batch_size.
When batch_size is greater than 1, the algorithm is called “mini-batch” gradient descent, and when batch_size is equal to len(dataset) we are talking about “batch” gradient descent.