Nanquantile
Nanquantile
torch_nanquantile(self, q, dim = NULL, keepdim = FALSE)
self |
(Tensor) the input tensor. |
q |
(float or Tensor) a scalar or 1D tensor of quantile values in the range |
dim |
(int) the dimension to reduce. |
keepdim |
(bool) whether the output tensor has |
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()
.
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) }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.