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

Method test_batch_fp16

tests/bert/tf_bert_unit_test.py:66–84  ·  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 if self.test_level >= 2:
68 print(f"[INFO] test level {self.test_level}, run unit test test_batch_fp16 (level {2})")
69 else:
70 print(f"[INFO] test level {self.test_level}, skip unit test test_batch_fp16 (level {2})")
71 return
72 args_dict = copy.deepcopy(self.common_args_dict)
73 args_dict['data_type'] = 'fp16'
74
75 for batch in [1, 8, 64, 128]:
76 args_dict['batch_size'] = batch
77 tf.reset_default_graph()
78 os.system("./bin/bert_gemm {} {} {} {} {} 0 > .tmp.gemm.log && cat gemm_config.in".format(args_dict['batch_size'], args_dict['max_seq_len'],
79 args_dict['head_number'], args_dict['size_per_head'],
80 args_dict['data_type'] == 'fp16'))
81 max_diff = bert_example(args_dict)
82 self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
83 max_diff = encoder_example(args_dict)
84 self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
85
86 def test_batch_bf16(self):
87 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