Do you use the same batch size to calculate the different losses?
If not, I’m not sure about the effects of this approach.
However, even without BatchNorm, your results will most likely depend on the batch size.
Maybe the results will be approx. the same, but the loss curve will look different.
Your code is not formatted properly, but it seems you are trying to do the following:
criterion = nn.MSELoss()
model = nn.Linear(10, 1)
x = torch.randn(10, 10)
y = torch.randn(10, 1)

# Use whole batch
output1 = model(x)
loss1 = criterion(output1, y)
loss1.backward()
print(model.weight.grad)

model.zero_grad()

# Use mini-batches
loss2 = 0
for x_, y_ in zip(x, y):
    x_.unsqueeze(0)
    y_.unsqueeze(0)
    
    output2 = model(x_)
    loss2 += criterion(output2, y_)

# Scale the loss, since we accumulated it
loss2 /= len(x)
loss2.backward()
print(model.weight.grad)

Let me know, if this is your use case.