The round operation would kill the gradient (almost) everywhere, so it’s indeed not very useful for training as seen here:
x = torch.randn(10, requires_grad=True)
y = torch.round(x)
y.mean().backward()
print(x.grad)
> tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])

You could try to implement this approach 6 posted by @tom, which would be able to use different “paths” during the forward and backward call.