| 35 | bool allow_gemm_test = false); |
| 36 | |
| 37 | int main(int argc, char** argv) |
| 38 | { |
| 39 | if (argc != 9 && argc != 10) { |
| 40 | printf("[ERROR] bert_int8_example batch_size num_layers seq_len head_num" |
| 41 | "size_per_head is_fp16 is_remove_padding int8_mode\n"); |
| 42 | printf("e.g., ./bin/bert_int8_example 1 12 128 12 64 1 0 2\n"); |
| 43 | return 0; |
| 44 | } |
| 45 | bool allow_gemm_test = false; |
| 46 | if (argc == 10) { |
| 47 | allow_gemm_test = (atoi(argv[9]) == 1) ? true : false; |
| 48 | } |
| 49 | |
| 50 | int batch_size = atoi(argv[1]); |
| 51 | int num_layers = atoi(argv[2]); |
| 52 | int seq_len = atoi(argv[3]); |
| 53 | int head_num = atoi(argv[4]); |
| 54 | int size_per_head = atoi(argv[5]); |
| 55 | int int8_mode = atoi(argv[8]); |
| 56 | bool is_remove_padding = static_cast<bool>(atoi(argv[7])); |
| 57 | |
| 58 | if (atoi(argv[6]) == 0) { |
| 59 | return bertINT8Example<float>( |
| 60 | batch_size, num_layers, seq_len, head_num, size_per_head, int8_mode, is_remove_padding, allow_gemm_test); |
| 61 | } |
| 62 | else if (atoi(argv[6]) == 1) { |
| 63 | return bertINT8Example<half>( |
| 64 | batch_size, num_layers, seq_len, head_num, size_per_head, int8_mode, is_remove_padding, allow_gemm_test); |
| 65 | } |
| 66 | else { |
| 67 | throw std::runtime_error(std::string("[FT][ERROR] is_fp16 should be 0 (use float)" |
| 68 | "or 1 (use half). \n ")); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | template<typename T> |
| 73 | int bertINT8Example(size_t batch_size, |
nothing calls this directly
no outgoing calls
no test coverage detected