code: def sum_sqnorm(arr):
      """Calculate the norm of the array.
  
      Args:
          arr (numpy.ndarray)
  
      Returns:
          Float: Sum of the norm calculated from the given array.
  
      """
      sq_sum = collections.defaultdict(float)
      for x in arr:
          with cuda.get_device_from_array(x) as dev:
              if x is not None:
                  x = x.ravel()
                  s = x.dot(x)
                  sq_sum[int(dev)] += s
      return sum([float(i) for i in sq_sum.values()])
  
imports: import collections
  import logging
  import math
  import numpy
  from chainer import cuda
  from chainer import functions
  from chainer import training
  from chainer.training import extension
  from chainer.training.updaters.multiprocess_parallel_updater import gather_grads, gather_params, scatter_grads
label_desc: Use image node_id 1 for calling a global function with example usage: sum_sqnorm(arr) and returns: sum