Ejemplo n.º 1
0
 def test_check_equal_node_name(self):
     opt1 = core.DeviceOption(0)
     opt2 = core.DeviceOption(0)
     self.assertTrue(core.device_option_equal(opt1, opt2))
     opt2.node_name = 'test'
     self.assertTrue(core.device_option_equal(opt1, opt2))
     self.assertFalse(core.device_option_equal(opt1, opt2, ignore_node_name=False))
     opt1.node_name = 'test'
     self.assertTrue(core.device_option_equal(opt1, opt2, ignore_node_name=False))
Ejemplo n.º 2
0
 def test_check_equal_node_name(self):
     opt1 = core.DeviceOption(0)
     opt2 = core.DeviceOption(0)
     self.assertTrue(core.device_option_equal(opt1, opt2))
     opt2.node_name = 'test'
     self.assertTrue(core.device_option_equal(opt1, opt2))
     self.assertFalse(core.device_option_equal(opt1, opt2, ignore_node_name=False))
     opt1.node_name = 'test'
     self.assertTrue(core.device_option_equal(opt1, opt2, ignore_node_name=False))
Ejemplo n.º 3
0
 def test_check_equal_default_value(self):
     opt1 = caffe2_pb2.DeviceOption()
     opt2 = caffe2_pb2.DeviceOption()
     opt1.device_type = 0
     self.assertTrue(core.device_option_equal(opt1, opt2))
     opt1.cuda_gpu_id = 5
     # opt1 still is on CPU, so the options should be equal
     self.assertTrue(core.device_option_equal(opt1, opt2))
     opt2.device_type = 0
     self.assertTrue(core.device_option_equal(opt1, opt2))
     opt1.device_type = 1
     self.assertFalse(core.device_option_equal(opt1, opt2))
Ejemplo n.º 4
0
 def test_check_equal_default_value(self):
     opt1 = caffe2_pb2.DeviceOption()
     opt2 = caffe2_pb2.DeviceOption()
     opt1.device_type = 0
     self.assertTrue(core.device_option_equal(opt1, opt2))
     opt1.device_id = 5
     # opt1 still is on CPU, so the options should be equal
     self.assertTrue(core.device_option_equal(opt1, opt2))
     opt2.device_type = 0
     self.assertTrue(core.device_option_equal(opt1, opt2))
     opt1.device_type = 1
     self.assertFalse(core.device_option_equal(opt1, opt2))