(layer_a, layer_b, prob_a)
return tl.Cond(condition, layer_a, layer_b)
Runs `layer_a` with probability `prob_a`, otherwise runs `layer_b`.
Runs `layer_a` with probability `prob_a`, otherwise runs `layer_b`.
Runs layer_a with probability prob_a otherwise runs layer_b .
def RandomLayer(layer_a, layer_b, prob_a):
  """Runs `layer_a` with probability `prob_a`, otherwise runs `layer_b`."""
  condition = tl.Serial(
      tl.RandomUniform(),
      tl.Fn('SmallerThan', lambda x: x < prob_a)
      )
  return tl.Cond(condition, layer_a, layer_b)
def RandomLayer ( layer_a , layer_b , prob_a ) : condition = tl . Serial ( tl . RandomUniform ( ) , tl . Fn ( 'SmallerThan' , lambda x : x < prob_a ) ) return tl . Cond ( condition , layer_a , layer_b )