code: def test_array_grad_with_backprop_id():
      array = chainerx.array([1.0, 1.0, 1.0], chainerx.float32)
      grad = chainerx.array([0.5, 0.5, 0.5], chainerx.float32)
  
      with chainerx.backprop_scope("bp1") as bp1:
          with pytest.raises(chainerx.ChainerxError):
              array.get_grad(bp1)
          with pytest.raises(chainerx.ChainerxError):
              array.set_grad(grad, bp1)
          with pytest.raises(chainerx.ChainerxError):
              array.cleargrad(bp1)
  
          array.require_grad(bp1).set_grad(grad, bp1)
          assert array.get_grad(bp1) is not None
          assert (
              array.get_grad(bp1)._debug_flat_data
              == grad._debug_flat_data
          )
  
          array.cleargrad(bp1)  # clear
          assert array.get_grad(bp1) is None
  
      # keyword arguments
      with chainerx.backprop_scope("bp2") as bp2:
          with pytest.raises(chainerx.ChainerxError):
              array.get_grad(backprop_id=bp2)
          with pytest.raises(chainerx.ChainerxError):
              array.set_grad(grad, backprop_id=bp2)
          with pytest.raises(chainerx.ChainerxError):
              array.cleargrad(backprop_id=bp2)
  
          array.require_grad(backprop_id=bp2).set_grad(
              grad, backprop_id=bp2
          )
          assert array.get_grad(bp2) is not None
          assert array.get_grad(backprop_id=bp2) is not None
          assert (
              array.get_grad(bp2)._debug_flat_data
              == grad._debug_flat_data
          )
          assert (
              array.get_grad(backprop_id=bp2)._debug_flat_data
              == grad._debug_flat_data
          )
  
          array.cleargrad(backprop_id=bp2)  # clear
          assert array.get_grad(bp2) is None
          assert array.get_grad(backprop_id=bp2) is None
  
imports: import copy
  import math
  import pickle
  import numpy
  import pytest
  import chainerx
  import chainerx.testing
  from chainerx_tests import array_utils
label_desc: Use image node_id 22 for calling a global function with example usage: test_array_grad_with_backprop_id() without return types