How can I define a new data type of tensor or set grad to bool tensor?

@fangwei123456 Yes, how would derivatives/gradients be performed on boolean tensors?
This seems related to my question here “What’s the use of torch.bool tensors?” (or my related AI.StackExchange question).