code: def np_shape(active=True):
      """Returns an activated/deactivated NumPy shape scope to be used in 'with' statement
      and captures code that needs the NumPy shape semantics, i.e. support of scalar and
      zero-size tensors.
  
      Please note that this is designed as an infrastructure for the incoming
      MXNet-NumPy operators. Legacy operators registered in the modules
      `mx.nd` and `mx.sym` are not guaranteed to behave like their counterparts
      in NumPy even within this scope.
  
      Parameters
      ----------
      active : bool
          Indicates whether to activate NumPy-shape semantics.
  
      Returns
      -------
      _NumpyShapeScope
          A scope object for wrapping the code w/ or w/o NumPy-shape semantics.
  
      Example::
  
          with mx.np_shape(active=True):
              # A scalar tensor's shape is `()`, whose `ndim` is `0`.
              scalar = mx.nd.ones(shape=())
              assert scalar.shape == ()
  
              # If NumPy shape semantics is enabled, 0 in a shape means that
              # dimension contains zero elements.
              data = mx.sym.var("data", shape=(0, 2, 3))
              ret = mx.sym.sin(data)
              arg_shapes, out_shapes, _ = ret.infer_shape()
              assert arg_shapes[0] == (0, 2, 3)
              assert out_shapes[0] == (0, 2, 3)
  
              # -1 means unknown shape dimension size in the new NumPy shape definition
              data = mx.sym.var("data", shape=(-1, 2, 3))
              ret = mx.sym.sin(data)
              arg_shapes, out_shapes, _ = ret.infer_shape_partial()
              assert arg_shapes[0] == (-1, 2, 3)
              assert out_shapes[0] == (-1, 2, 3)
  
              # When a shape is completely unknown when NumPy shape semantics is on, it is
              # represented as `None` in Python.
              data = mx.sym.var("data")
              ret = mx.sym.sin(data)
              arg_shapes, out_shapes, _ = ret.infer_shape_partial()
              assert arg_shapes[0] is None
              assert out_shapes[0] is None
  
          with mx.np_shape(active=False):
              # 0 means unknown shape dimension size in the legacy shape definition.
              data = mx.sym.var("data", shape=(0, 2, 3))
              ret = mx.sym.sin(data)
              arg_shapes, out_shapes, _ = ret.infer_shape_partial()
              assert arg_shapes[0] == (0, 2, 3)
              assert out_shapes[0] == (0, 2, 3)
  
              # When a shape is completely unknown in the legacy mode (default), its ndim is
              # equal to 0 and it is represented as `()` in Python.
              data = mx.sym.var("data")
              ret = mx.sym.sin(data)
              arg_shapes, out_shapes, _ = ret.infer_shape_partial()
              assert arg_shapes[0] == ()
              assert out_shapes[0] == ()
      """
      return _NumpyShapeScope(active)
  
imports: import ctypes
  import functools
  import inspect
  import threading
  import tempfile
  import platform
  from contextlib import contextmanager
  from struct import calcsize
  from .base import _LIB, check_call, c_str, py_str, numeric_types, integer_types, long, _MAX_VALUE_64_BIT_UNSIGNED_, _MAX_VALUE_64_BIT_SIGNED_, _MAX_VALUE_FLOAT32_REPRESENT_
label_desc: Use image node_id 5 for calling a global function with example usage: np_shape(active) and returns: _NumpyShapeScope