I trained a model based on bert-large-cased using the run_text_classification.py 3 tensorflow example. I converted the model to onnx using the convert_graph_to_onnx.py tool.
That looks like this:
convert_graph_to_onnx.convert(
        framework='tf',
        model="output",
        output=Path("model/model.onnx"),
        opset=12,
        tokenizer="output",
        use_external_format=True,
        pipeline_name="sentiment-analysis")


I’m having a slight difficulty understanding the inputs and outputs. I am trying to use Rust and the onnxruntime 1. The onnx model input shape is (?, 5). I am using input_ids, attention mask, token ids constructed from the tokenizers Rust library. For example
the inputs I’m using
[[101, 1, 0, 0, 0],
 [1104, 1, 0, 0, 0],
 [23120, 1, 0, 0, 0],
 [188, 1, 0, 0, 0],
 [19091, 1, 0, 0, 0],
 [8124, 1, 0, 0, 0],
 [1111, 1, 0, 0, 0],
 [3062, 1, 0, 0, 0],
 [1105, 1, 0, 0, 0],
 [15470, 1, 0, 0, 0],
 [119, 1, 0, 0, 0],
 [102, 1, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
...
...

I truncate + pad the tokens out to 128 length, since I used a max length of 128 when training the model.
the outputs are logits (I think) in the shape (?, 4). My sentiment analysis task has 4 classes, so I think this makes sense.
[[0.87741166, 0.4000733, -2.557633, 1.5771139],
 [-0.7227318, -0.14528184, 2.4809465, -1.7312673],
 [0.88585603, 0.392128, -2.54713, 1.5852065],
 [-0.89909637, 0.5074229, 2.3639672, -1.8381689],
 [0.8940967, 0.40258378, -2.5756738, 1.5999701],
...
...

Since this is a sentiment-analysis task why are there logits for each token?
Any advice on things to check? Any things stand out as obviously wrong?