histogramdd#
- deepinv.physics.functional.histogramdd(x, bins=10, low=None, upp=None, bounded=False, weights=None, sparse=False, edges=None)[source]#
Computes the multidimensional histogram of a tensor.
This is a
torchimplementation ofnumpy.histogramdd. This function is borrowed from torchist.Note
Similar to
numpy.histogram, all bins are half-open except the last bin which also includes the upper bound.- Parameters:
x (torch.Tensor) – A tensor, (*, D).
bins (int, list[int]) – The number of bins in each dimension, scalar or (D,).
low (float, list[float]) – The lower bound in each dimension, scalar or (D,). If
lowisNone, the min ofxis used instead.upp (float, list[float]) – The upper bound in each dimension, scalar or (D,). If
uppisNone, the max ofxis used instead.bounded (bool) – Whether
xis bounded bylowandupp, included. IfFalse, out-of-bounds values are filtered out.weights (torch.Tensor) – A tensor of weights,
(\*,). Each sample ofxcontributes its associated weight towards the bin count (instead of 1).sparse (bool) – Whether the histogram is returned as a sparse tensor or not.
edges (torch.Tensor, list[torch.Tensor]) – The edges of the histogram. Either a vector or a list of vectors. If provided,
bins,lowanduppare inferred fromedges.
- Returns:
(
torch.Tensor) : the histogram- Return type: