code: def test_get_unlinked_variable():
      v = nn.Variable([2, 3, 4], need_grad=True)
      grad = np.random.randn(*v.shape).astype(np.float32)
      v.g = grad
      v.d = np.random.randn(*v.shape)
      import nnabla.functions as F
  
      with nn.context_scope(nn.Context()), nn.auto_forward():
          v2 = F.identity(v)
          v2_u = v2.get_unlinked_variable()
          assert v2_u.need_grad
          v3 = F.identity(v2_u)
      v2_u.grad.zero()
      v2_g = v2_u.g.copy()
      v3.backward(clear_buffer=False)
      assert type(v2_u) == type(v2)
      assert np.all(v.g == grad)
      assert np.all(v2_u.g == v2.g)
      assert np.all(v2_u.g == v2_g + 1)
  
      # Check need_grad option
      assert v2.get_unlinked_variable(need_grad=True).need_grad
      assert not v2.get_unlinked_variable(need_grad=False).need_grad
  
imports: import pytest
  import numpy
  import nnabla
  from nnabla.testing import assert_allclose
label_desc: Use image node_id 6 for calling a global function with example usage: test_get_unlinked_variable() without return types