code: def test_scope():
      class TestBlock1(gluon.HybridBlock):
          def __init__(self):
              super(TestBlock1, self).__init__()
  
          def forward(self, data):
              (new_data,) = mx.npx.cond(
                  pred=lambda data: data > 0.5,
                  then_func=lambda data: data * 2,
                  else_func=lambda data: data * 3,
                  inputs=data,
                  name="my_cond",
              )
              return new_data
  
      class TestBlock2(gluon.HybridBlock):
          def __init__(self):
              super(TestBlock2, self).__init__()
  
          def forward(self, data):
              (new_data,) = mx.npx.cond(
                  pred=lambda data: data > 0.5,
                  then_func=lambda data: data * 2,
                  else_func=lambda data: data * 3,
                  inputs=data,
                  name="my_cond",
              )
              return new_data
  
      AttrScope._subgraph_names = defaultdict(int)
      data = mx.np.random.normal(loc=0, scale=1, size=(1,))
      with AttrScope(__subgraph_name__="my_cond"):
          block1 = TestBlock1()
          block1.initialize(device=default_device())
          block1.hybridize()
          _ = block1(data)
          block2 = TestBlock2()
          block2.initialize(device=default_device())
          block2.hybridize()
          _ = block2(data)
          assert len(AttrScope._subgraph_names) == 3
          assert AttrScope._subgraph_names["my_cond$my_cond_else"] == 2
          assert AttrScope._subgraph_names["my_cond$my_cond_pred"] == 2
          assert AttrScope._subgraph_names["my_cond$my_cond_then"] == 2
  
imports: import copy
  import numpy
  import mxnet
  from mxnet import gluon
  from mxnet.test_utils import *
  from mxnet.base import _as_list
  from collections import defaultdict
  from mxnet.attribute import AttrScope
label_desc: Use image node_id 9 for calling a global function with example usage: test_scope() and returns: new_data, new_data