@Test public void buildVariableProfileTableIfInputProfileNameNotFound() throws Exception { final String path = getResourceFilePath("models/and_op.onnx"); final int batchSize = 1; final int inputDim = 2; final String inputProfileName = "__non_existent_variable__"; final String inputVariableNameInModel = "input"; final String outputProfileName = "output"; try ( ModelData modelData = ModelData.fromOnnxFile(path); VariableProfileTableBuilder vptBuilder = VariableProfileTable.builder() .addInputProfile(inputProfileName, DType.FLOAT, new int[] {batchSize, inputDim}) .addOutputProfile(outputProfileName, DType.FLOAT) ) { MenohException e = assertThrows(MenohException.class, () -> vptBuilder.build(modelData)); assertAll("input profile name not found", () -> assertEquals(ErrorCode.VARIABLE_NOT_FOUND, e.getErrorCode()), () -> assertEquals( String.format("menoh variable not found error: %s (variable_not_found)", inputVariableNameInModel), e.getMessage()) ); } }
public static VariableProfileTableBuilder builder() throws MenohException { final PointerByReference ref = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref)); return new VariableProfileTableBuilder(ref.getValue()); }
VariableProfileTable implements AutoCloseable { public static VariableProfileTableBuilder builder() throws MenohException { final PointerByReference ref = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref)); return new VariableProfileTableBuilder(ref.getValue()); } }
VariableProfileTable implements AutoCloseable { public static VariableProfileTableBuilder builder() throws MenohException { final PointerByReference ref = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref)); return new VariableProfileTableBuilder(ref.getValue()); } VariableProfileTable(Pointer handle); }
VariableProfileTable implements AutoCloseable { public static VariableProfileTableBuilder builder() throws MenohException { final PointerByReference ref = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref)); return new VariableProfileTableBuilder(ref.getValue()); } VariableProfileTable(Pointer handle); @Override void close(); static VariableProfileTableBuilder builder(); VariableProfile variableProfile(String variableName); }
VariableProfileTable implements AutoCloseable { public static VariableProfileTableBuilder builder() throws MenohException { final PointerByReference ref = new PointerByReference(); checkError(MenohNative.INSTANCE.menoh_make_variable_profile_table_builder(ref)); return new VariableProfileTableBuilder(ref.getValue()); } VariableProfileTable(Pointer handle); @Override void close(); static VariableProfileTableBuilder builder(); VariableProfile variableProfile(String variableName);  }