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
torch
implementation 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
low
isNone
, the min ofx
is used instead.upp (float, list[float]) – The upper bound in each dimension, scalar or (D,). If
upp
isNone
, the max ofx
is used instead.bounded (bool) – Whether
x
is bounded bylow
andupp
, included. IfFalse
, out-of-bounds values are filtered out.weights (torch.Tensor) – A tensor of weights,
(\*,)
. Each sample ofx
contributes 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
,low
andupp
are inferred fromedges
.
- Returns:
(
torch.Tensor
) : the histogram- Return type: