ClikaRT::ops::nan_to_num
function
nan_to_num()
Tensor nan_to_num(
Tensor x,
std::optional<double> nan = std::nullopt,
std::optional<double> posinf = std::nullopt,
std::optional<double> neginf = std::nullopt
)
Replaces NaN and infinities with finite values.
Each absent replacement falls back to the dtype-specific default: 0 for NaN, the dtype's largest finite value for +inf, its lowest for -inf.
Parameters
x: the input tensor.nan: replacement for NaN. Default:0.posinf: replacement for+inf. Default: the dtype's max.neginf: replacement for-inf. Default: the dtype's lowest.
Throws
ClikaRT::Error: when the input's dtype is not served for this operation (the machine-readable reason ridescode_name()).
Returns: a new tensor, same shape and dtype as x.
auto y = ClikaRT::ops::nan_to_num(x); // dtype defaults
auto z = ClikaRT::ops::nan_to_num(x, 0.0, 1e4, -1e4);
Declared in ClikaRT/compute/ops.h, line 5070