Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-deterministic and suspicious errors #89

Open
msakai opened this issue Sep 5, 2018 · 3 comments
Open

Non-deterministic and suspicious errors #89

msakai opened this issue Sep 5, 2018 · 3 comments
Assignees

Comments

@msakai
Copy link
Member

msakai commented Sep 5, 2018

I ran the following program with the attached ggnn.onnx in ggnn.zip.

#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 1;                                       \
        }                                                   \
    }

int main()
{
    menoh_model_data_handle model_data;
    ERROR_CHECK(
      menoh_make_model_data_from_onnx("ggnn.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_4(
      vpt_builder, "111980687600", menoh_dtype_float, 32, 4, 51, 51));
    ERROR_CHECK(menoh_variable_profile_table_builder_add_input_profile_dims_4(
      vpt_builder, "111980687712", menoh_dtype_float, 32, 51, 16, 1));
    ERROR_CHECK(menoh_variable_profile_table_builder_add_output_profile(
      vpt_builder, "112043339960", 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));

    return 0;
}

The results are non-deterministic and the "menoh variable not found error" errors raise the doubt of bug.

$ gcc `pkg-config menoh --libs --cflags` test.c
$ ./a.out 
menoh unsupported operator error: Transpose
$ ./a.out 
menoh variable not found error: 112043186328
$ ./a.out 
menoh variable not found error: 112043186328
$ ./a.out 
menoh variable not found error: 112043244120
$ ./a.out 
menoh variable not found error: 112043244400
$ ./a.out 
menoh unsupported operator error: Identity
$ ./a.out 
menoh unsupported operator error: Transpose
$ ./a.out 
menoh unsupported operator error: Identity
$ ./a.out 
menoh unsupported operator error: Transpose
$ ./a.out 
menoh unsupported operator error: Transpose
$ ./a.out 
menoh unsupported operator error: Transpose
$ ./a.out 
menoh unsupported operator error: Identity
$ ./a.out 
menoh unsupported operator error: Transpose
$ ./a.out 
menoh unsupported operator error: Transpose
$ 
@msakai msakai assigned msakai and okdshin and unassigned msakai Sep 5, 2018
@msakai
Copy link
Member Author

msakai commented Sep 5, 2018

I dumped the model using following script with modified version of onnx-chainer https://github.com/msakai/onnx-chainer/tree/94baaf4294c7e8ae1a255cc5823535fe1e1dd9e7 :

import numpy as np
import chainer
import chainer_chemistry
from chainer_chemistry.models import GGNN
import onnx_chainer

mb = 32
edge_type = 4
atom = 51
n_atom_types = chainer_chemistry.config.MAX_ATOMIC_NUM # 117

n_unit = 16
conv_layers = 4

#atom_array = chainer.Variable(np.arange(mb * atom, dtype=np.int32).reshape(mb, atom) % n_atom_types)
atom_array2 = chainer.Variable(np.zeros((32,51,16,1), dtype=np.float32))
adj = chainer.Variable(np.ones((mb, edge_type, atom, atom), dtype=np.float32))

class Dummy(chainer.Chain):
    def __init__(self):
        super().__init__()
        with self.init_scope():
            self.m = GGNN(out_dim=n_unit, hidden_dim=n_unit, n_layers=conv_layers)
    
    def __call__(self, atom_array2, adj):
        return self.m(atom_array2.reshape((32,51,16)), adj)

onnx_chainer.export(Dummy(), [atom_array2, adj], filename='ggnn.onnx')

@okdshin
Copy link
Contributor

okdshin commented Sep 5, 2018

The non-deterministic results may be occured from this line.
I made PR #90 to remove it. Whould you try it?

That menoh variable not found error may relate to #42.

@msakai
Copy link
Member Author

msakai commented Sep 6, 2018

With #90 it always fails with menoh unsupported operator error: Identity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants