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

Method test_batch_fp32

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

Source from the content-addressed store, hash-verified

48 threshold = {'fp32': 4e-5, 'fp16': 4e-2, 'bf16': 5e-2 }
49
50 def test_batch_fp32(self):
51 args_dict = copy.deepcopy(self.common_args_dict)
52
53 for batch in [1, 8, 64, 128]:
54 args_dict['batch_size'] = batch
55
56 os.system("./bin/bert_gemm {} {} {} {} {} 0 > .tmp.gemm.log && cat gemm_config.in".format(args_dict['batch_size'], args_dict['seq_len'],
57 args_dict['head_num'], args_dict['head_size'],
58 args_dict['data_type'] == 'fp16'))
59 max_diff = bert_example(args_dict)
60 sys.stdout.flush()
61 self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
62 max_diff = encoder_example(args_dict)
63 sys.stdout.flush()
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)

Callers

nothing calls this directly

Calls 2

bert_exampleFunction · 0.90
encoder_exampleFunction · 0.90

Tested by

no test coverage detected