Try printing the values of torch.max(dy) and torch.min(dy) after the line
dy = dy / maximum_dy

, to see if the dy values are such that they saturate the Sigmoid function. That is, whether all (or most) of the dy values drive the Sigmoid function to zero or one.