def test_seqlen_fp32(self):
        args_dict = copy.deepcopy(self.common_args_dict)
        args_dict['data_type'] = 'fp32'

        for seqlen in [32, 128, 512]:
            args_dict['max_seq_len'] = seqlen
            max_diff = encoder_sample(args_dict)
            tf.reset_default_graph()
            self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
    def test_batch_fp16(self):
        args_dict = copy.deepcopy(self.common_args_dict)
        args_dict['data_type'] = 'fp16'

        for batch in [1, 8, 64, 128]:
            args_dict['batch_size'] = batch
            max_diff = encoder_sample(args_dict)
            tf.reset_default_graph()
            self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
    def test_remove_padding_fp16(self):
        args_dict = copy.deepcopy(self.common_args_dict)
        args_dict['data_type'] = 'fp16'

        for avg_seq_len in [32, 64, 128]:
            args_dict['max_seq_len'] = 256
            args_dict['remove_padding'] = 'True'
            args_dict['avg_seq_len'] = avg_seq_len

            max_diff = encoder_sample(args_dict)
            tf.reset_default_graph()
            self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
Exemplo n.º 4
0
    def test_batch_fp16(self):
        args_dict = copy.deepcopy(self.common_args_dict)
        args_dict['data_type'] = 'fp16'

        for batch in [1, 8, 64, 128]:
            args_dict['batch_size'] = batch
            tf.reset_default_graph()
            os.system("./bin/encoder_gemm {} {} {} {} {} 0".format(
                args_dict['batch_size'], args_dict['max_seq_len'],
                args_dict['head_number'], args_dict['size_per_head'],
                args_dict['data_type'] == 'fp16'))
            max_diff = encoder_sample(args_dict)
            self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
Exemplo n.º 5
0
    def test_seqlen_fp32(self):
        args_dict = copy.deepcopy(self.common_args_dict)
        args_dict['data_type'] = 'fp32'

        for seqlen in [32, 130, 512, 1024]:
            args_dict['max_seq_len'] = seqlen
            tf.reset_default_graph()
            os.system("./bin/encoder_gemm {} {} {} {} {} 0".format(
                args_dict['batch_size'], args_dict['max_seq_len'],
                args_dict['head_number'], args_dict['size_per_head'],
                args_dict['data_type'] == 'fp16'))
            max_diff = encoder_sample(args_dict)
            self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
    def test_hidden_fp16(self):
        args_dict = copy.deepcopy(self.common_args_dict)
        args_dict['data_type'] = 'fp16'

        for p in [
                tuple([12, 64]),
                tuple([16, 64]),
                tuple([4, 32]),
                tuple([8, 96])
        ]:
            args_dict['head_number'] = p[0]
            args_dict['size_per_head'] = p[1]
            max_diff = encoder_sample(args_dict)
            tf.reset_default_graph()
            self.assertTrue(max_diff < self.threshold[args_dict['data_type']])
Exemplo n.º 7
0
    def test_hidden_fp16(self):
        args_dict = copy.deepcopy(self.common_args_dict)
        args_dict['data_type'] = 'fp16'

        for p in [
                tuple([12, 64]),
                tuple([16, 64]),
                tuple([4, 32]),
                tuple([8, 96])
        ]:
            args_dict['head_number'] = p[0]
            args_dict['size_per_head'] = p[1]
            tf.reset_default_graph()
            os.system("./bin/encoder_gemm {} {} {} {} {} 0".format(
                args_dict['batch_size'], args_dict['max_seq_len'],
                args_dict['head_number'], args_dict['size_per_head'],
                args_dict['data_type'] == 'fp16'))
            max_diff = encoder_sample(args_dict)
            self.assertTrue(max_diff < self.threshold[args_dict['data_type']])