Manually bias addition after convolution

I want to manually add the bias after convolution of input and weights. But output of convolution is 4-D tensor like torch.Size(1,3,30,30) and bias is of size torch.Size([3]), what reshape operation should I use to perform addition

You could unsqueeze the bias or add new dims by indexing it with Nones:

out = torch.randn(2, 3, 24, 24)
bias = torch.randn(3)

out = out + bias[None, :, None, None]
# or
out = out + bias.unsqueeze(0).unsqueeze(2).unsqueeze(3)

Thanks @ptrblck for your help.
I am able to do this also using
bias = bias.view(-1, 1, 1).expand_as(out)