def get_current_remat_mode():
    """Get the current rematerialization mode and associated settings.

    Returns:
        RematMode or None: The current rematerialization mode, or None if not
        set.
    """
    remat_scope_stack = global_state.get_global_attribute("remat_scope_stack")
    if not remat_scope_stack:
        return None
    active_scope = remat_scope_stack[-1]
    return RematMode(
        active_scope.mode,
        active_scope.output_size_threshold,
        active_scope.layer_names,
    )
Get the current rematerialization mode and associated settings.

    Returns:
        RematMode or None: The current rematerialization mode, or None if not
        set.
    
keras/src/backend/common/remat.py