code: def on_cpu_gpu(func):
      @functools.wraps(func)
      def wrapper_decorator(*args, **kwargs):
          func(*args, dev=cpu_dev, **kwargs)
          if singa.USE_CUDA:
              func(*args, dev=gpu_dev, **kwargs)
  
      return wrapper_decorator
  
imports: from __future__ import division
  import math
  import unittest
  import numpy
  import functools
  from singa import tensor
  from singa import singa_wrap
  from singa import opt
  from cuda_helper import gpu_dev, cpu_dev
label_desc: Use image node_id 2 for calling a global function with example usage: on_cpu_gpu(func) and returns: wrapper_decorator