Esempio n. 1
0
    def test_from_array(self, backend_config):
        arr = backend_config.get_array(numpy.ndarray((2, ), numpy.float32))
        # Test precondition check
        assert isinstance(arr, intel64.mdarray)

        expected_device = backend.Intel64Device()

        device = backend.Intel64Device.from_array(arr)
        assert device == expected_device

        device = backend.get_device_from_array(arr)
        assert device == expected_device
Esempio n. 2
0
 def device(self):
     if self._device is None:
         if self.use_cuda:
             device = chainer.get_device(
                 chainer.backends.cuda.Device(self.cuda_device))
         elif self.use_chainerx:
             device = chainer.get_device(self.chainerx_device)
         elif self.use_ideep != 'never':
             device = backend.Intel64Device()
         else:
             device = backend.CpuDevice()
         self._device = device
     return self._device
Esempio n. 3
0
 def test_init(self):
     device = backend.Intel64Device()
     self.check_device(device)