(name: str, value: TfExpressionEx, passthru: TfExpressionEx = None, condition: TfExpressionEx = True)
Create a new autosummary.

    Args:
        name:     Name to use in TensorBoard
        value:    TensorFlow expression or python value to track
        passthru: Optionally return this TF node without modifications but tack an autosummary update side-effect to this node.

    Example use of the passthru mechanism:

    n = autosummary('l2loss', loss, passthru=n)

    This is a shorthand for the following code:

    with tf.control_dependencies([autosummary('l2loss', loss)]):
        n = tf.identity(n)
Create a new autosummary.
Create a new autosummary .
def autosummary(name: str, value: TfExpressionEx, passthru: TfExpressionEx = None, condition: TfExpressionEx = True) -> TfExpressionEx:
    """Create a new autosummary.

    Args:
        name:     Name to use in TensorBoard
        value:    TensorFlow expression or python value to track
        passthru: Optionally return this TF node without modifications but tack an autosummary update side-effect to this node.

    Example use of the passthru mechanism:

    n = autosummary('l2loss', loss, passthru=n)

    This is a shorthand for the following code:

    with tf.control_dependencies([autosummary('l2loss', loss)]):
        n = tf.identity(n)
    """
    tfutil.assert_tf_initialized()
    name_id = name.replace("/", "_")

    if tfutil.is_tf_expression(value):
        with tf.name_scope("summary_" + name_id), tf.device(value.device):
            condition = tf.convert_to_tensor(condition, name='condition')
            update_op = tf.cond(condition, lambda: tf.group(_create_var(name, value)), tf.no_op)
            with tf.control_dependencies([update_op]):
                return tf.identity(value if passthru is None else passthru)

    else:  # python scalar or numpy array
        assert not tfutil.is_tf_expression(passthru)
        assert not tfutil.is_tf_expression(condition)
        if condition:
            if name not in _immediate:
                with tfutil.absolute_name_scope("Autosummary/" + name_id), tf.device(None), tf.control_dependencies(None):
                    update_value = tf.placeholder(_dtype)
                    update_op = _create_var(name, update_value)
                    _immediate[name] = update_op, update_value
            update_op, update_value = _immediate[name]
            tfutil.run(update_op, {update_value: value})
        return value if passthru is None else passthru
def autosummary ( name : str , value : TfExpressionEx , passthru : TfExpressionEx = None , condition : TfExpressionEx = True ) -> TfExpressionEx : tfutil . assert_tf_initialized ( ) name_id = name . replace ( "/" , "_" ) if tfutil . is_tf_expression ( value ) : with tf . name_scope ( "summary_" + name_id ) , tf . device ( value . device ) : condition = tf . convert_to_tensor ( condition , name = 'condition' ) update_op = tf . cond ( condition , lambda : tf . group ( _create_var ( name , value ) ) , tf . no_op ) with tf . control_dependencies ( [ update_op ] ) : return tf . identity ( value if passthru is None else passthru ) else : # python scalar or numpy array assert not tfutil . is_tf_expression ( passthru ) assert not tfutil . is_tf_expression ( condition ) if condition : if name not in _immediate : with tfutil . absolute_name_scope ( "Autosummary/" + name_id ) , tf . device ( None ) , tf . control_dependencies ( None ) : update_value = tf . placeholder ( _dtype ) update_op = _create_var ( name , update_value ) _immediate [ name ] = update_op , update_value update_op , update_value = _immediate [ name ] tfutil . run ( update_op , { update_value : value } ) return value if passthru is None else passthru