code: def test_replace_node_with_indirect_node_ref():
      #  a
      # / \
      # x  b[y=y]
      # |  |
      # y  x
      #    |
      #    y
  
      def dummy_model(name, layers):
          return Model(
              name, lambda model, X, is_train: ..., layers=layers
          )
  
      y = dummy_model("y", [])
      x = dummy_model("x", [y])
  
      y_debug = with_debug(y)
  
      b = dummy_model("b", [x])
      b.set_ref("y", y)
  
      a = chain(x, b)
      a.name = "a"
  
      a.replace_node(y, y_debug)
  
      assert a.layers[0].layers[0] == y_debug
      assert a.layers[1].layers[0].layers[0] == y_debug
      assert a.layers[1].get_ref("y") == y_debug
  
imports: import threading
  import time
  from collections import Counter
  import numpy
  import pytest
  from thinc.api import Adam, CupyOps, Dropout, Linear, Model, Relu, Shim, Softmax, chain, change_attr_values, concatenate, set_dropout_rate, use_ops, with_debug, wrap_model_recursive
  from thinc.compat import has_cupy_gpu
  from ..util import make_tempdir
label_desc: Use image node_id 27 for calling a global function with example usage: test_replace_node_with_indirect_node_ref() and returns: Model