(String[] args)
| 515 | } |
| 516 | |
| 517 | public static void main(String[] args) { |
| 518 | |
| 519 | String signatureName = "default_serving"; |
| 520 | String[] inputNames = new String[TOTAL_COUNT]; |
| 521 | int[] dataTypes = new int[TOTAL_COUNT]; |
| 522 | long[][] shapes = new long[TOTAL_COUNT][2]; |
| 523 | float[][] floatContent = new float[FLOAT_COUNT][DIM_0*DIM_1]; |
| 524 | long[][] longContent = new long[LONG_COUNT][DIM_0*DIM_1]; |
| 525 | double[][] doubleContent = new double[DOUBLE_COUNT][DIM_0*DIM_1]; |
| 526 | int[][] intContent = new int[INT_COUNT][DIM_0*DIM_1]; |
| 527 | String[][] stringContent = new String[STRING_COUNT][DIM_0*DIM_1]; |
| 528 | String[] fetchNames = new String[3]; |
| 529 | |
| 530 | prepareData(signatureName, inputNames, dataTypes, shapes, |
| 531 | floatContent, longContent, doubleContent, |
| 532 | intContent, stringContent, fetchNames); |
| 533 | |
| 534 | if (PRINT_DATA) { |
| 535 | printData(signatureName, inputNames, dataTypes, shapes, |
| 536 | floatContent, longContent, doubleContent, |
| 537 | intContent, stringContent, fetchNames); |
| 538 | } |
| 539 | |
| 540 | // ================ flatbuffer =================== |
| 541 | double startFBMillis = System.currentTimeMillis(); |
| 542 | int fbLen = 0; |
| 543 | for (int x = 0; x < TESTING_COUNT; ++x) { |
| 544 | // encode |
| 545 | FlatBufferBuilder fbb = new FlatBufferBuilder(20000); |
| 546 | |
| 547 | // no copy here, convert user content to |
| 548 | // flatbuffer data directly. |
| 549 | encodeByFlatBuffer(fbb, signatureName, inputNames, dataTypes, |
| 550 | shapes, floatContent, longContent, |
| 551 | doubleContent, intContent, |
| 552 | stringContent, fetchNames); |
| 553 | |
| 554 | byte[] buf = fbb.sizedByteArray(); |
| 555 | fbLen = buf.length; |
| 556 | |
| 557 | if (WRITE_TO_FILE) { |
| 558 | try { |
| 559 | File file = new File("/tmp/request_buf.bin"); |
| 560 | FileOutputStream fop = new FileOutputStream(file); |
| 561 | fop.write(buf); |
| 562 | fop.flush(); |
| 563 | fop.close(); |
| 564 | } catch (IOException e) { |
| 565 | e.printStackTrace(); |
| 566 | } |
| 567 | } |
| 568 | |
| 569 | if (PRINT_FB) { |
| 570 | printFB(ByteBuffer.wrap(buf)); |
| 571 | } |
| 572 | } |
| 573 | double endFBMillis = System.currentTimeMillis(); |
| 574 |
nothing calls this directly
no test coverage detected