I found histc function in new pytorch version and I want to use it to implement my some ideas. but I get a problem that I can only get the statistical result using this function. However, can I get inverse mapping from this result to the input tensor, for example, if I input a tensor with any possible size to torch.histc, how can I get the corresponding frequency and bin index of one tensor value to the histogram result ?

Can you share me with any interesting idea? Thank you ！

I’m not sure if this is currently possible with this method.

However, you could calculate the bin borders and use these values as a threshold to index your tensor.

```
x = torch.arange(10).float()
low = 5.
high = 7.
(low <= x) * (x < high)
```

Would that help in any kind?

Hi Ptrblck,

I need to apply histogram I used

```
xxx=torch.histc(CMBMASKGaussy,100, min=0, max=1, out=None)
```

But I need to know the bins elements too. How I can extract the bins elements from this function exactly as it is used?

As an another way I used

```
FFBins=[]
for jj1 in np.arange(0,1.03,.012):
FFBins.append(jj1)
hist_r = np.histogram(CMBMASKGaussy.squeeze(1).view(-1).detach().numpy(),bins=FFBins,range=[0 ,1])
count_r = hist_r[0]
bins = hist_r[1]
```

why the number of the bins is one more than the count_r ? They should be same.I need to be precise, would you please help me with that which of them god to use?