Torch.histc along an axis?

hi,
is there a way to compute histogram for each row of matrix of size (n, m) using torch.histc
so far, histc computes the histogram of the the entire tensor.

thanks

2 Likes

not conveniently, you’d have to do something like

x = torch.randn(3,3,3,3)*10
a = torch.tensor([torch.histc(x[i], 100, 0, 20).tolist() for i in range(3)])

sure
but i was looking for batchable operation with no loop.
thanks

1 Like