torch.nanquantile
-
torch.nanquantile(input, q, dim=None, keepdim=False, *, out=None) → Tensor -
This is a variant of
torch.quantile()that “ignores”NaNvalues, computing the quantilesqas ifNaNvalues ininputdid not exist. If all values in a reduced row areNaNthen the quantiles for that reduction will beNaN. See the documentation fortorch.quantile().- Parameters
- Keyword Arguments
-
out (Tensor, optional) – the output tensor.
Example:
>>> t = torch.tensor([float('nan'), 1, 2]) >>> t.quantile(0.5) tensor(nan) >>> t.nanquantile(0.5) tensor(1.5000) >>> t = torch.tensor([[float('nan'), float('nan')], [1, 2]]) >>> t tensor([[nan, nan], [1., 2.]]) >>> t.nanquantile(0.5, dim=0) tensor([1., 2.]) >>> t.nanquantile(0.5, dim=1) tensor([ nan, 1.5000])
© 2019 Torch Contributors
Licensed under the 3-clause BSD License.
https://pytorch.org/docs/1.8.0/generated/torch.nanquantile.html