code: def _as_type2_helper(self, dev):
      shape1 = [1, 2, 3, 4]
      shape2 = [4, 3, 2, 1]
      np_int = np.random.randint(0, 10, shape1).astype(np.int32)
      np_flt = np_int.astype(np.float32)
  
      t1 = singa_api.Tensor(shape1, dev, singa_api.kInt)
      t1.CopyIntDataFromHostPtr(np_int.flatten())
      _ctensor_eq_ndarray(t1, np_int)
  
      t1 = singa_api.Reshape(t1, shape2)
      t2 = t1.AsType(singa_api.kFloat32)
      _ctensor_eq_ndarray(t2, np_flt.reshape(shape2))
  
      t3 = t2.AsType(singa_api.kInt)
      _ctensor_eq_ndarray(t3, np_int.reshape(shape2))
  
      t1 = singa_api.Reshape(t1, shape1)
      t4 = t1.AsType(singa_api.kFloat32)
      _ctensor_eq_ndarray(t4, np_flt.reshape(shape1))
  
imports: from __future__ import division
  import unittest
  import math
  import numpy
  from singa import singa_wrap
  from singa import tensor
  from cuda_helper import gpu_dev, cpu_dev
label_desc: Use image node_id 32 for calling the TestAPI obj's underlying member method code with example usage: obj._as_type2_helper(dev) without return types