median(input: Tensor, dim: _int | None = ..., keepdim: _bool = ...)Median of a tensor along dim (or over the whole tensor when None).
Unlike nanmedian, a NaN entry in a reduced slice propagates
to the slice's median and its index names the first NaN in input
order, matching the reference framework.
Parameters
inputTensorReal-valued input tensor (floating-point or integer).
dimint | NoneAxis along which to take the median, or
None for all elements.keepdimboolWhether the reduced dimension is kept with size
1 (default False).Returns
Examples
>>> import lucid
>>> lucid.median(lucid.tensor([1.0, 5.0, 3.0, 2.0]))
tensor(2.)