Probably something like
eps = 1e-7
z = torch.zeros((), device=a.device, dtype=a.dtype)
a_new = torch.where((a - 1.5).abs() < eps, a, z)

probably is what you want.
Note that a == 1.5 might not be a good condition to test for due to the accuracy limits of floating-point computation.
You can assign the new thing to a again if you want.
Best regards
Thomas