class chainer.Flag[ソース]


It takes three values: ON, OFF, and AUTO.

ON and OFF flag can be evaluated as a boolean value. These are converted to True and False, respectively. AUTO flag cannot be converted to boolean. In this case, ValueError is raised.

パラメータ:name (str, bool, or None) –

Name of the flag. Following values are allowed:

  • 'on', 'ON', or True for ON value
  • 'off', 'OFF', or False for OFF value
  • 'auto', 'AUTO', or None for AUTO value
chainer.ON = ON

Equivalent to Flag(‘on’).

chainer.OFF = OFF

Equivalent to Flag(‘off’).

chainer.AUTO = AUTO

Equivalent to Flag(‘auto’).



If both ON and OFF are found, this function raises an error. Otherwise, either of ON and OFF that appeared is returned. If all flags are AUTO, then it returns AUTO.

パラメータ:flags (sequence of Flag) – Input flags.
戻り値:The result of aggregation.