Hi,
gO has to be equal to the length of b. If you have b with a single value, doing b.backward() is a convenient way to write b.backward(torch.Tensor[1]).
The fact that you can give a gradient with a different size than the element is a bug and will give undefined behaviour.
@apaszke checks should be added to make sure that the sizes matter here right?