oneflow.utils.global_view.current_global_mode

class oneflow.utils.global_view.current_global_mode

Get the current global mode information.

Use the current_global_mode to get the information of global mode, including enabled, placement and sbp.

Note

The sbp property is supposed to return a list/tuple of oneflow.sbp.sbp.

For example:

with global_mode(True, placement=P, sbp=B):
    # Get the global mode info.
    cur_global_mode = global_view.current_global_mode()
    test_case.assertTrue(cur_global_mode.is_enabled)
    test_case.assertEqual(cur_global_mode.placement, P)
    test_case.assertEqual(cur_global_mode.sbp[0], B)