Context

Global Mode

global_mode

texar.tf.global_mode()[source]

Returns the Tensor of global mode.

This is a placeholder with default value of tf.estimator.ModeKeys.TRAIN.

Example

mode = session.run(global_mode())
# mode == tf.estimator.ModeKeys.TRAIN

mode = session.run(
    global_mode(),
    feed_dict={tf.global_mode(): tf.estimator.ModeKeys.PREDICT})
# mode == tf.estimator.ModeKeys.PREDICT

global_mode_train

texar.tf.global_mode_train()[source]

Returns a bool Tensor indicating whether the global mode is TRAIN.

Example

is_train = session.run(global_mode_train())
# is_train == True

is_train = session.run(
    global_mode_train()
    feed_dict={tf.global_mode(): tf.estimator.ModeKeys.PREDICT})
# is_train == False

global_mode_eval

texar.tf.global_mode_eval()[source]

Returns a bool Tensor indicating whether the global mode is EVAL.

global_mode_predict

texar.tf.global_mode_predict()[source]

Returns a bool Tensor indicating whether the global mode is PREDICT.

valid_modes

texar.tf.valid_modes()[source]

Returns a set of possible values of mode.