alibaba / alibaba/TinyNeuralNetwork
TransposeConv wrong shape?
- Dominant language
- Python
- Stars
- 879
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
The TFlite code doesn't like the shape of the Transpose Convolution node I have in my TinyNN converted network. It seems consistent across Transpose Convolutions that it expects the bias to match the size of the first dimension, but it is in fact the size of the last dimension in my TinyNN-converted network. (The error is on the first TransposeConv, but there are a number of similarly-formed ones in the network which will presumably have the same error).
The network runs fine before conversion, and the tflite looks very sensible in netron, but TFlite runtime doesn't like it...
It gives an error of:
> Unexpected failure when preparing tensor allocations: tensorflow/lite/kernels/transpose_conv.cc:289 NumElements(bias) != SizeOfDimension(weights, 0) (3 != 1)
> Node number 194 (TRANSPOSE_CONV) failed to prepare.
The node in question has (according to netron):
> input 1x4x4x3
> output shape <4>
> Weights <1x2x2x3>
> Bias<3>
> output 1x8x8x3
which evidently doesn't match TFLite's rules. Is this a conversion error, or how do I cope with it?
Incidentally, the biases in all the Transpose Convolutions are entirely 0s and the Weights a suspiciously simple arrangement of 1s and 0s. Bias being optional for this TFLite operator, is there a way to not include it?
Contributor guide
Research direction
Start by reproducing the converted network in the TFLite runtime and inspect the failing TRANSPOSE_CONV at transpose_conv.cc:289, comparing the reported input, output, weights, and bias shapes with the converter output. Done means determining whether conversion produced the invalid shape and either making the node acceptable to TFLite or documenting how to omit the zero bias.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100