(scalar_stopping_signal)
Detects whether scalar_stopping_signal indicates stopping.
Detects whether scalar_stopping_signal indicates stopping.
Detects whether scalar_stopping_signal indicates stopping .
def should_stop(scalar_stopping_signal):
    """Detects whether scalar_stopping_signal indicates stopping."""
    if isinstance(scalar_stopping_signal, ops.Tensor):
      # STOPPING_SIGNAL is a constant True. Here, the logical_and is just the TF
      # way to express the bool check whether scalar_stopping_signal is True.
      return math_ops.logical_and(scalar_stopping_signal,
                                  _StopSignals.STOPPING_SIGNAL)
    else:
      # For non Tensor case, it is used in SessionRunHook. So, we cannot modify
      # the graph anymore. Here, we use pure Python.
      return bool(scalar_stopping_signal)
def should_stop ( scalar_stopping_signal ) : if isinstance ( scalar_stopping_signal , ops . Tensor ) : # STOPPING_SIGNAL is a constant True. Here, the logical_and is just the TF # way to express the bool check whether scalar_stopping_signal is True. return math_ops . logical_and ( scalar_stopping_signal , _StopSignals . STOPPING_SIGNAL ) else : # For non Tensor case, it is used in SessionRunHook. So, we cannot modify # the graph anymore. Here, we use pure Python. return bool ( scalar_stopping_signal )