library("SpaNorm")
hasBadValues(matrix(c(1, NA, 3, 4), 2, 2))[1] TRUE
TRUE if x (tensor or matrix) holds any NA/NaN/ Inf. On a tensor this is a scalar reduction copied back, not a full GPU->CPU materialisation of x.
hasBadValues(x)
x
|
a matrix or torch tensor. |
a logical.