If I understand your use case correctly, you would like to use these coordinates to mask the area in an image?
If so, you could index the input directly and assign the new value to it:
X, Y, H, W, = 1, 2, 3, 3
x = torch.randn(2, 3, 5, 5)

x[:, :, Y:Y+H, X:X+W] = 0.
print(x)