Flag

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’).

chainer.flag.aggregate_flags(flags)[ソース]

一連のフラグを指定して集約フラグを返します。

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.
戻り値の型:Flag