code: def _as_type_helper(self, dev):
      np1 = np.random.random([3]).astype(np.float32)
      np1 = np1 * 10 - 5
      np2 = np1.astype(np.int32)
      np3 = np2.astype(np.float32)
  
      t1 = tensor.Tensor(device=dev, data=np1)
  
      t1 = tensor.Tensor(device=dev, data=np1)
  
      t1_ct = t1.data
  
      self.assertEqual(t1_ct.data_type(), singa_api.kFloat32)
  
      t1_ct = t1_ct.AsType(singa_api.kInt)
  
      self.assertEqual(t1_ct.data_type(), singa_api.kInt)
  
      np.testing.assert_array_almost_equal(
          tensor.to_numpy(_cTensor_to_pyTensor(t1_ct)), np2
      )
  
      t1_ct = t1_ct.AsType(singa_api.kFloat32)
  
      self.assertEqual(t1_ct.data_type(), singa_api.kFloat32)
  
      np.testing.assert_array_almost_equal(
          tensor.to_numpy(_cTensor_to_pyTensor(t1_ct)), np3
      )
  
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 29 for calling the TestAPI obj's underlying member method code with example usage: obj._as_type_helper(dev) without return types