MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / test_batch_fp16

Method test_batch_fp16

tests/bert/th_bert_unit_test.py:66–81  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

64 self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
65
66 def test_batch_fp16(self):
67 args_dict = copy.deepcopy(self.common_args_dict)
68 args_dict['data_type'] = 'fp16'
69
70 for batch in [1, 8, 64, 128]:
71 args_dict['batch_size'] = batch
72
73 os.system("./bin/bert_gemm {} {} {} {} {} 0 > .tmp.gemm.log && cat gemm_config.in".format(args_dict['batch_size'], args_dict['seq_len'],
74 args_dict['head_num'], args_dict['head_size'],
75 args_dict['data_type'] == 'fp16'))
76 max_diff = bert_example(args_dict)
77 sys.stdout.flush()
78 self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
79 max_diff = encoder_example(args_dict)
80 sys.stdout.flush()
81 self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
82
83 def test_hidden_fp32(self):
84 args_dict = copy.deepcopy(self.common_args_dict)

Callers

nothing calls this directly

Calls 2

bert_exampleFunction · 0.90
encoder_exampleFunction · 0.90

Tested by

no test coverage detected