A softmax in the 3rd dimension on 4D data seems unsupported.
Here is simple TensorFlow code which is stand-alone and produces the issue. It classifies MNIST, data is automatically downloaded. The ProtoBuf graph is automatically created by the code. Here is the code:
The command I used to create the DLC is:
snpe-tensorflow-to-dlc --graph graph.pb --input_dim input 28,28,1 --out_node output --dlc graph.dlc
The message I get from the tool is:
388 - WARNING - WARNING_TF_SCOPE_OP_NOT_CONSUMED: Scope (softmax) operation(s) not consumed by converter: [u'Shape', u'Sub', u'ConcatV2', u'Shape']
Hello CN,
SNPE does not currently support 4D input tensors (batched inputs). You may want to try the following with a single element in the batch dimension:
Thanks for your reply. The message I get with the new flag is (independent if I set the batch size to 1 or not):
To give a bit more background here:
The included example code (although written as an MNIST classification problem) mimics a use-case of semantic segmentation. A typical result of a semantic segmentation will be a 4D output with dimensions (batch, width, height, class). To get a final classification, a softmax is usually employed. This softmax is done only on the last (3rd) dimension (class), not on the batch, width, or height dimension. Tensorflow only has softmax on 2D data implemented, and thus it reshapes from (batch, width, height, class) to (batch * width * height, class) before doing the softmax and then reshapes afterwards. This is what SNPE struggles with.
Note that I am fine with any batch size, but it seems right now the 'pixel batch' of 28x28 pixels causes the problem. Do you perhaps have an example of SNPE-compatible Tensorflow code doing semantic segmentation?
I have just re-run the original problem with the latest version of SNPE (1.6.0). Also adding the "allow_unconsumed_nodes" flag does not help. Here is the error I now get:
Did you manage to reproduce the problem given the code I posted?
Can you post the result of using the option --allow_unconsumed_nodes ?
Please post the exact command line used for conversion. We have been able to convert the excerpt graph provided in this thread.
I have just re-done everything to be 100% sure. Here is what I did:
Bump. We're also affected by this, and would love to see Softmax supported on 3D tensors.
The use case for us is using Softmax in a differentiable depth image-based rendering layer, similar to Deep3D (https://arxiv.org/pdf/1604.03650.pdf). Without Softmax, we have been unable to achieve the same quality of results that we've been able to obtain with it.
We ended up working around this by using a series of point-wise convolutions as an approximation of softmax.
This approximation converges to an L1 loss of .006 for us, which is accurate enough for our application.