fn
histogram2d_op
→vector<TensorImplPtr>int histogram2d_op(const int & a, const int & b, int bins_a, int bins_b, double lo_a, double hi_a, double lo_b, double hi_b, bool density)Python wrappers
Public Python APIs implemented by this engine symbol.Compute a 2-D histogram from two equal-length 1-D tensors.
Treats paired observations (a_k, b_k) as samples on an
grid of uniform rectangular
cells and counts the number of pairs falling in each cell. When
density is true each cell value is divided by
(step_a * step_b * N).
See Also
histogram_op : 1-D variant. histogramdd_op : General N-dimensional variant.
Parameters
aTensorImplPtr1-D tensor of x-coordinates.
bTensorImplPtr1-D tensor of y-coordinates. Must match
a in length, dtype, and device.bins_aint64Number of bins along the x-axis.
bins_bint64Number of bins along the y-axis.
lo_a, hi_adoubleRange of the x-axis.
lo_b, hi_bdoubleRange of the y-axis.
densityboolIf true, normalise to a probability density.
Returns
vector<TensorImplPtr>[counts, edges] where counts has shape (bins_a, bins_b) and edges has shape (bins_a + 1 + bins_b + 1,) — the x-edges followed by the y-edges concatenated. Both dtype F64.
Notes
Non-differentiable. Executes on the CPU stream regardless of input device.