Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

12: Modes and random operations

E1201

Call without its Mode. A call leaves out an argument whose parameter is a Mode, as a call to dropout without one does. There is no global training flag, so whether a call trains, and the seed its random numbers come from, are arguments. Pass Train(seed=…) to train or Eval to evaluate.

fn f(x: [b D]) -> [b D] = x |> dropout(0.1)

See Modes.

E1202

Value isn’t a Mode. A Mode parameter or return type got something other than Train(seed=…), Eval or a value of type Mode, such as a bool that says whether to train.

fn f(x: [b D], training: bool) -> [b D] = dropout(x, 0.1, training)

See Modes.