Nanquantile
Source:R/gen-namespace-docs.R, R/gen-namespace-examples.R, R/gen-namespace.R
torch_nanquantile.RdNanquantile
nanquantile(input, q, dim=None, keepdim=FALSE, *, out=None) -> Tensor
This is a variant of torch_quantile() that "ignores" NaN values,
computing the quantiles q as if NaN values in input did
not exist. If all values in a reduced row are NaN then the quantiles for
that reduction will be NaN. See the documentation for torch_quantile().
Examples
if (torch_is_installed()) {
t <- torch_tensor(c(NaN, 1, 2))
t$quantile(0.5)
t$nanquantile(0.5)
t <- torch_tensor(rbind(c(NaN, NaN), c(1, 2)))
t
t$nanquantile(0.5, dim=1)
t$nanquantile(0.5, dim=2)
torch_nanquantile(t, 0.5, dim = 1)
torch_nanquantile(t, 0.5, dim = 2)
}
#> torch_tensor
#> nan 1.5000
#> [ CPUFloatType{1,2} ]