Hi, all

I want to calculate the histogram with Variables and find the torch.histc function. Unfortunately, this function does not support the Variables. Any alternatives?

Thanks

Hi, all

I want to calculate the histogram with Variables and find the torch.histc function. Unfortunately, this function does not support the Variables. Any alternatives?

Thanks

If you donâ€™t need to backprop through the output of the histogram, you can call torch.histc on the tensor data of the variable. ie if `x`

is your variable, you can get its tensor data via `x.data`

.

Honestly, I want to use the histogram as the loss function, hence I need to call the histc on the variable

1 Like

Did you ever figure out how to do this? When I try to backpropagate through torch.histc tensor I am told â€śthe derivative for â€śhistcâ€ť is not implementedâ€ť

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().