def test_from_json(self): self.assertEqual( Config(max_batch_size=7, enable_fp16=False, enable_strict_types=False), Config.from_json({'max_batch_size': 7})) self.assertEqual( Config(max_batch_size=7, enable_fp16=False, enable_strict_types=False), Config.from_json({ 'max_batch_size': 7, 'enable_fp16': False })) self.assertEqual( Config(max_batch_size=7, enable_fp16=True, enable_strict_types=False), Config.from_json({ 'max_batch_size': 7, 'enable_fp16': True })) self.assertEqual( Config(max_batch_size=7, enable_fp16=False, enable_strict_types=True), Config.from_json({ 'max_batch_size': 7, 'enable_strict_types': True }))
def test_from_json(self): self.assertEqual(TensorrtConfig(max_batch_size=7, data_type=None, enable_strict_types=False), TensorrtConfig.from_json({'max_batch_size': 7})) self.assertEqual(TensorrtConfig(max_batch_size=7, data_type=None, enable_strict_types=False), TensorrtConfig.from_json({'max_batch_size': 7, 'data_type': None})) self.assertEqual(TensorrtConfig(max_batch_size=7, data_type='FP16', enable_strict_types=False), TensorrtConfig.from_json({'max_batch_size': 7, 'data_type': 'FP16'})) self.assertEqual(TensorrtConfig(max_batch_size=7, data_type=None, enable_strict_types=True), TensorrtConfig.from_json({'max_batch_size': 7, 'enable_strict_types': True}))
def test_from_json(self): self.assertEqual(Config.from_json({'max_batch_size': 7}), Config(max_batch_size=7))