I want to use bool tensor with float grad. But in default, the data type of tensor’s grad is same with the tensor’s data.
x = torch.rand([8]) > 0.5
x.requires_grad_(True)

RuntimeError: only Tensors of floating point dtype can require gradients