View source: R/gen-namespace.R
torch_nanquantile | R Documentation |
Nanquantile
torch_nanquantile(
self,
q,
dim = NULL,
keepdim = FALSE,
interpolation = "linear"
)
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 |
interpolation |
The interpolation method. |
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.