{aif …botherwise\begin{cases} a & \text{if } \dots \\ b & \text{otherwise} \end{cases}

Cases — an if/else

A large left brace with several lines is an if/else written vertically. Read each line as "this value, if this condition holds" and use the line whose condition is true.

Each row has a value, then a condition. Exactly one condition should be true for any input. It is if / elif / else in maths notation. The causal mask, the repetition penalty and the multimodal label mask are written this way.

Example

∣x∣={x,if x≥0−x,if x<0|x| = \begin{cases} x, & \text{if } x \ge 0 \\ -x, & \text{if } x < 0 \end{cases}

Absolute value: for x = -3 the second line applies, giving 3.

Where the course uses it

Related terms