ifThenElse

fun ifThenElse(condition: FloatScalar, truePart: DScalar, falsePart: DScalar): DScalar
fun ifThenElse(condition: Float, truePart: Float, falsePart: Float): Float


fun ifThenElse(condition: DTensor, truePart: DTensor, falsePart: DTensor): DTensor

Test whether an input value condition is greater than zero (true), or less than or equal to zero (false). Each element of the result is, depending on the value in condition:

  • If the input value is greater than zero: the corresponding value taken from truePart

  • Otherwise: the corresponding value taken from falsePart

The three argument tensors should be the same shape (after broadcasting).


fun ifThenElse(condition: DScalar, truePart: DScalar, falsePart: DScalar): DScalar

Test whether an input value tested is greater than zero, or less than or equal to zero. Each element of the result is, depending on the value in tested:

  • If the input value is greater than zero: the corresponding value taken from whenGreater

  • Otherwise: the corresponding value taken from whenLessThanOrEqual

The three argument tensors should be the same shape (after broadcasting).