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

Method test_seqlen_fp16

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

Source from the content-addressed store, hash-verified

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)
142 args_dict['data_type'] = 'fp16'
143
144 for seqlen in [32, 130, 511, 1024, 1536]:
145 args_dict['seq_len'] = seqlen
146 if seqlen == 1536:
147 args_dict['layer_num'] = 6
148
149 os.system("./bin/bert_gemm {} {} {} {} {} 0 > .tmp.gemm.log && cat gemm_config.in".format(args_dict['batch_size'], args_dict['seq_len'],
150 args_dict['head_num'], args_dict['head_size'],
151 args_dict['data_type'] == 'fp16'))
152 max_diff = bert_example(args_dict)
153 sys.stdout.flush()
154 self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
155 max_diff = encoder_example(args_dict)
156 sys.stdout.flush()
157 self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
158
159if __name__ == "__main__":
160 unittest.main()

Callers

nothing calls this directly

Calls 2

bert_exampleFunction · 0.90
encoder_exampleFunction · 0.90

Tested by

no test coverage detected