"Unsupported operation type or rank" with example

When I ran the example test_add_1x4x4x4_f32 as described in Readme:

$ ./build/reference_model/tosa_reference_model
-Csubgraph_dir=examples/test_add_1x4x4x4_f32/flatbuffer-tflite
-Csubgraph_file=test_add_1x4x4x4_f32.tosa
-Cinput_dir=examples/test_add_1x4x4x4_f32/
-Coutput_dir=examples_out/test_add_1x4x4x4_f32/
-Coutput_tensor_prefix=ref_model_tflite_
-Cinput_tensor=InputTensor-tflite0:InputTensor-tflite0.npy,InputTensor-tflite1:InputTensor-tflite1.npy

I got the error “Unsupported operation type or rank.”.

After some debugging, it seems OpFactory::newOp just return a nullptr for Op_ADD.

I converted test_add_1x4x4x4_f32.tosa to json, it shows dtype=9
tensors: [
{
name: “InputTensor-tf0”,
shape: [
1,
4,
4,
1
],
type: 9,
npy_filename: “\u0001”
},

but the code handling Op_ADD in OpFactory::newOp only accpts dtype=[0, 6].

So the question is, is the test_add_1x4x4x4_f32.tosa a valid tosa file?

We’ve updated the flatbuffer schema recently (removed Usage and Format fields), but it appears that we failed to update the .tosa files to match the new schema, which is causing the error you are seeing. We should be able to redo the .tosa files to match the new schema soon, and we’ll put some testing in place to make sure we avoid breaking them in the future. I’ll post another reply once we’ve updated the files in the tree.
Thanks for pointing this out, and sorry for the inconvenience.

The files are updated, if you pull the latest code from the repository it should work with the reference model.

Feel free to let us know if you run into any more trouble.

It works after pulling the update. Thanks.

By the way, the code has some compilation error in flatuffer using gcc-10. It is not a big issue though.