onnx/models

Bidaf model includes CategoryMapper op with rank-4 input, although the input must be a tensor of strings or integers, either [N,C] or [C].

negiyas opened this issue · 0 comments

Bug Report

Which model does this pertain to?

Bidaf https://github.com/onnx/models/tree/main/text/machine_comprehension/bidirectional_attention_flow

Describe the bug

The model includes CategoryMapper op with rank-4 input, although the input rank should be one or two.

image

According to the onnx.ml.CategoryMapper definition at https://github.com/onnx/onnx/blob/main/docs/Operators-ml.md#ai.onnx.ml.CategoryMapper, The input must be a tensor of strings or integers, either [N,C] or [C].

As you know, onnx.CategoryMapper op is a simple string-to-integer (or integer-to-string) mapper, any input shape can be supported naturally, but the operation definition and the bidaf model are not consistent.

I am not sure if the operation definition is too strict or the model is illegal, but I am happy if the official bidaf model will be fixed.

CategoryMapper op definition

ai.onnx.ml.CategoryMapper
Converts strings to integers and vice versa.
...
Inputs
X : T1
    Input data
Outputs
Y : T2
    Output data. If strings are input, the output values are integers, and vice versa.

Type Constraints
T1 : tensor(string), tensor(int64)
    The input must be a tensor of strings or integers, either [N,C] or [C].
T2 : tensor(string), tensor(int64)
    The output is a tensor of strings or integers. Its shape will be the same as the input shape.  

Reproduction instructions

N/A

Notes

N/A