menoh icon indicating copy to clipboard operation
menoh copied to clipboard

variable not found error on a very simple model

Open msakai opened this issue 6 years ago • 1 comments

I experimented with the following simple model (add1.onnx.zip), but I encountered menoh variable not found error: 103249637448 error.

ONNX version is 3
opset_import_size is 1

4 
domain is 
model version is 0
producer name is Chainer
producer version is 4.2.0
parameter list
name: 103249637448 dims: 2 2  values: min_value: 1 max_value: 1 

node list
node num is 1
0:Add
	input0: 4393462696
	input1: 103249637448
	output0: 111895884240

My code is as follows:

#include <menoh/menoh.h>
#include <stdio.h>

#define ERROR_CHECK(statement)                              \
    {                                                       \
        menoh_error_code ec = statement;                    \
        if(ec) {                                            \
            printf("%s\n", menoh_get_last_error_message()); \
            return 0;                                       \
        }                                                   \
    }

int main()
{
    const char* in_name = "4393462696";
    const char* out_name = "111895884240";

    menoh_model_data_handle model_data;
    ERROR_CHECK(
      menoh_make_model_data_from_onnx("add1.onnx", &model_data));

    menoh_variable_profile_table_builder_handle vpt_builder;
    ERROR_CHECK(menoh_make_variable_profile_table_builder(&vpt_builder));

    ERROR_CHECK(menoh_variable_profile_table_builder_add_input_profile_dims_2(
      vpt_builder, in_name, menoh_dtype_float, 2, 2));

    ERROR_CHECK(menoh_variable_profile_table_builder_add_output_profile(
      vpt_builder, out_name, menoh_dtype_float));

    menoh_variable_profile_table_handle variable_profile_table;
    ERROR_CHECK(menoh_build_variable_profile_table(vpt_builder, model_data,
                                                   &variable_profile_table));

    ERROR_CHECK(menoh_model_data_optimize(model_data, variable_profile_table));

    menoh_model_builder_handle model_builder;
    ERROR_CHECK(
      menoh_make_model_builder(variable_profile_table, &model_builder));

    menoh_model_handle model;
    ERROR_CHECK(
      menoh_build_model(model_builder, model_data, "mkldnn", "", &model));
}

Is there something wrong with this code or the model?

msakai avatar Jul 05 '18 15:07 msakai

Thank you! I found the wrong code. I will fix it. We should add such a test for other operators too.

okdshin avatar Jul 07 '18 15:07 okdshin