onnx-chainer icon indicating copy to clipboard operation
onnx-chainer copied to clipboard

model preparing ?

Open vlordier opened this issue 4 years ago • 1 comments

I am getting a 'Unexpected output type from the model: {}'.format(type(outputs))) and I wonder if I need to do something to prepare my Chainer model (output layer naming or something) prior to export ?

not sure how to debug that.

vlordier avatar Sep 08 '19 13:09 vlordier

The error is from https://github.com/chainer/onnx-chainer/blob/v1.5.1a1/onnx_chainer/export.py#L399

If the target model returns a value which is not chainer.Variable type, the RuntimeError would be, example:

class Model(chainer.Chain):

    def __init__(self):
        super().__init__()
        with self.init_scope():
            self.l1 = L.Linear(4)
            self.l2 = L.Linear(5, initial_bias=0.1)

    def forward(self, x):
        y = self.l1(x)
        z = self.l2(y)
        return z.array  # return numpy ndarray, not return chainer.Variable, then cannot export

If you couldn't clear the issue, could you provide reproducible source?

disktnk avatar Sep 09 '19 02:09 disktnk