code: def test_v2v_update_all(idtype):
      def _test(fld):
          def message_func(edges):
              return {"m": edges.src[fld]}
  
          def message_func_edge(edges):
              if len(edges.src[fld].shape) == 1:
                  return {"m": edges.src[fld] * edges.data["e1"]}
              else:
                  return {"m": edges.src[fld] * edges.data["e2"]}
  
          def reduce_func(nodes):
              return {fld: F.sum(nodes.mailbox["m"], 1)}
  
          def apply_func(nodes):
              return {fld: 2 * nodes.data[fld]}
  
          g = generate_graph(idtype)
          # update all
          v1 = g.ndata[fld]
          g.update_all(
              fn.copy_u(u=fld, out="m"),
              fn.sum(msg="m", out=fld),
              apply_func,
          )
          v2 = g.ndata[fld]
          g.ndata.update({fld: v1})
          g.update_all(message_func, reduce_func, apply_func)
          v3 = g.ndata[fld]
          assert F.allclose(v2, v3)
          # update all with edge weights
          v1 = g.ndata[fld]
          g.update_all(
              fn.u_mul_e(fld, "e1", "m"),
              fn.sum(msg="m", out=fld),
              apply_func,
          )
          v2 = g.ndata[fld]
          g.ndata.update({fld: v1})
          g.update_all(message_func_edge, reduce_func, apply_func)
          v4 = g.ndata[fld]
          assert F.allclose(v2, v4)
  
      # test 1d node features
      _test("f1")
      # test 2d node features
      _test("f2")
  
file_path: dgl/tests/python/common/test_heterograph-specialization.py
imports: import backend
  import dgl
  import dgl.function
  import numpy
  import scipy.sparse
  from utils import parametrize_idtype
label_desc: Use image node_id 2 for calling a global function with example usage: test_v2v_update_all(idtype) and returns: dict, dict, dict, dict, dict