(self)
| 84 | self.assertTrue(max_diff < self.threshold[args_dict['data_type']]) |
| 85 | |
| 86 | def test_batch_bf16(self): |
| 87 | if self.test_level >= 2: |
| 88 | print(f"[INFO] test level {self.test_level}, run unit test test_batch_bf16 (level {2})") |
| 89 | else: |
| 90 | print(f"[INFO] test level {self.test_level}, skip unit test test_batch_bf16 (level {2})") |
| 91 | return |
| 92 | args_dict = copy.deepcopy(self.common_args_dict) |
| 93 | args_dict['data_type'] = 'bf16' |
| 94 | |
| 95 | for batch in [1, 8, 64, 128]: |
| 96 | args_dict['batch_size'] = batch |
| 97 | tf.reset_default_graph() |
| 98 | os.system("./bin/bert_gemm {} {} {} {} 2 0 > .tmp.gemm.log && cat gemm_config.in".format(args_dict['batch_size'], args_dict['max_seq_len'], |
| 99 | args_dict['head_number'], args_dict['size_per_head'])) |
| 100 | max_diff = bert_example(args_dict) |
| 101 | self.assertTrue(max_diff < self.threshold[args_dict['data_type']]) |
| 102 | max_diff = encoder_example(args_dict) |
| 103 | self.assertTrue(max_diff < self.threshold[args_dict['data_type']]) |
| 104 | |
| 105 | def test_size_fp32(self): |
| 106 | if self.test_level >= 3: |
nothing calls this directly
no test coverage detected