>>> c = torch.rand(5,10)
>>> c.requires_grad = True
>>> minc, _ = c.min(1)
>>> maxc, _ = c.max(1)
>>> deltac = maxc - minc
>>> s = deltac / maxc
>>> s.sum().backward()
>>> s
tensor([0.9689, 0.8587, 0.8610, 0.9500, 0.9923], grad_fn=<DivBackward0>)
>>> c.grad.max()
tensor(0.1661)

I can’t reproduce your problem.