(self)
| 118 | self.assertTrue(max_diff < self.threshold[args_dict['data_type']]) |
| 119 | |
| 120 | def test_seqlen_fp32(self): |
| 121 | args_dict = copy.deepcopy(self.common_args_dict) |
| 122 | |
| 123 | for seqlen in [32, 130, 511, 1024, 1536]: |
| 124 | args_dict['seq_len'] = seqlen |
| 125 | if seqlen == 1536: |
| 126 | args_dict['layer_num'] = 6 |
| 127 | |
| 128 | threshold_tmp = {'fp32': 1e-4, 'fp16': 4e-2, 'bf16': 5e-2} # The error of encoder on this test is larger |
| 129 | |
| 130 | os.system("./bin/bert_gemm {} {} {} {} {} 0 > .tmp.gemm.log && cat gemm_config.in".format(args_dict['batch_size'], args_dict['seq_len'], |
| 131 | args_dict['head_num'], args_dict['head_size'], |
| 132 | args_dict['data_type'] == 'fp16')) |
| 133 | max_diff = bert_example(args_dict) |
| 134 | sys.stdout.flush() |
| 135 | self.assertTrue(max_diff < threshold_tmp[args_dict['data_type']]) |
| 136 | max_diff = encoder_example(args_dict) |
| 137 | sys.stdout.flush() |
| 138 | self.assertTrue(max_diff < threshold_tmp[args_dict['data_type']]) |
| 139 | |
| 140 | def test_seqlen_fp16(self): |
| 141 | args_dict = copy.deepcopy(self.common_args_dict) |
nothing calls this directly
no test coverage detected