You can call the whale.current_scope_as_default operation to specify the current scope as the default scope. This topic describes the syntax and features of the operation. This topic also provides the sample code to show you how to call the operation.

  • Syntax
    current_scope_as_default()
  • Description

    Specifies the current scope as the default scope. If an operator is defined outside a scope, the operator is placed in the default scope.

  • Parameters

    None.

  • Return value

    None.

  • Examples
    import whale as wh
    
    with wh.replica():  # The current scope.
        c1 = tf.constant(1)
        wh.current_scope_as_default()  # Specify the current scope as the default scope.
    
    c2 = tf.constant(2)  # C2 is defined outside the current scope. However, the current scope is specified as the default scope. This way, C2 and C1 are placed in the same scope.