Same question. It seems like torch.histc() doesn’t have derivative function, and is not supposed to be a part of loss, or any part of computational graph. Maybe one could write his own histc() and implement the derivative, but in my opinion, it is hard with select operations inside of histc().