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

Method test_batch_fp32

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

Source from the content-addressed store, hash-verified

44 test_level = 1
45
46 def test_batch_fp32(self):
47 if self.test_level >= 3:
48 print(f"[INFO] test level {self.test_level}, run unit test test_batch_fp32 (level {3})")
49 else:
50 print(f"[INFO] test level {self.test_level}, skip unit test test_batch_fp32 (level {3})")
51 return
52 args_dict = copy.deepcopy(self.common_args_dict)
53 args_dict['data_type'] = 'fp32'
54
55 for batch in [1, 8, 64, 128]:
56 args_dict['batch_size'] = batch
57 tf.reset_default_graph()
58 os.system("./bin/bert_gemm {} {} {} {} {} 0 > .tmp.gemm.log && cat gemm_config.in".format(args_dict['batch_size'], args_dict['max_seq_len'],
59 args_dict['head_number'], args_dict['size_per_head'],
60 args_dict['data_type'] == 'fp16'))
61 max_diff = bert_example(args_dict)
62 self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
63 max_diff = encoder_example(args_dict)
64 self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
65
66 def test_batch_fp16(self):
67 if self.test_level >= 2:

Callers

nothing calls this directly

Calls 2

bert_exampleFunction · 0.90
encoder_exampleFunction · 0.90

Tested by

no test coverage detected