code: def test_model_set_reference():
      parent = create_model("parent")
      child = create_model("child")
      grandchild = create_model("child")
      parent.layers.append(child)
      assert parent.ref_names == tuple()
      parent.set_ref("kid", child)
      assert parent.ref_names == ("kid",)
      assert parent.get_ref("kid") is child
      child.layers.append(grandchild)
      with pytest.raises(KeyError):
          parent.get_ref("grandkid")
      parent.set_ref("grandkid", grandchild)
      assert parent.get_ref("grandkid") is grandchild
      parent.remove_node(grandchild)
      assert grandchild not in child.layers
      assert not parent.has_ref("grandkind")
  
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 10 for calling a global function with example usage: test_model_set_reference() without return types