mortont / axon_onnx

Easily convert models between ONNX and Axon
Apache License 2.0
95 stars 20 forks source link

ArgumentError during predict of deserialized model (mobilenet_v2) #26

Closed jallum closed 2 years ago

jallum commented 2 years ago

While attempting to run predict() on a image, I encountered the following ArgumentError:

** (Axon.CompilerError) error while building prediction for #Function<15.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for avg_pool:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for batch_norm:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for add:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for add:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for batch_norm:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for add:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for add:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for batch_norm:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for add:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for add:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for add:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for batch_norm:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for add:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for add:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for batch_norm:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for add:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for batch_norm:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for batch_norm:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for conv:

** (Axon.CompilerError) error while building prediction for #Function<65.88948663/2 in AxonOnnx.Deserialize.recur_nodes/2>:

** (Axon.CompilerError) error while building prediction for conv:

** (ArgumentError) size of input channels divided by feature groups must match size of kernel channels, got 32 / 1 != 1 for shapes {1, 32, 112, 112} and {32, 1, 3, 3}

Here's how the model (imagenet_mobilenet_v2_100_224_feature_vector_5.zip) was decoded:

{model, params} =
  "priv/imagenet_mobilenet_v2_100_224_feature_vector_5.onnx"
  |> AxonOnnx.import([{:unk__666, 1}])

The model seems to decode properly:

{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                                                                                                      Model
==================================================================================================================================================================================================================================================================================================================================================
 Layer                                                                                                                                                                                                                                                                     Shape               Policy              Parameters   Parameters Memory
==================================================================================================================================================================================================================================================================================================================================================
 inputs ( input )                                                                                                                                                                                                                                                          {1, 224, 224, 3}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/hub_input/Mul:0 ( Mul["inputs"] )                                                                                                                                                                                 {1, 224, 224, 3}    p=f32 c=f32 o=f32   1            4 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/hub_input/Sub:0 ( Sub["StatefulPartitionedCall/StatefulPartitionedCall/predict/hub_input/Mul:0"] )                                                                                                                {1, 224, 224, 3}    p=f32 c=f32 o=f32   1            4 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv/Conv2D__6:0 ( transpose["StatefulPartitionedCall/StatefulPartitionedCall/predict/hub_input/Sub:0"] )                                                                                             {1, 3, 224, 224}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv/Conv2D__6:0"] )                                                                    {1, 32, 112, 112}   p=f32 c=f32 o=f32   896          3584 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv/BatchNorm/FusedBatchNormV3:0"] )                                                                        {1, 32, 112, 112}   p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv/Relu6:0"] )                                                     {1, 32, 112, 112}   p=f32 c=f32 o=f32   9248         36992 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv/depthwise/BatchNorm/FusedBatchNormV3:0"] )                                  {1, 32, 112, 112}   p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv/depthwise/Relu6:0"] )                                    {1, 16, 112, 112}   p=f32 c=f32 o=f32   528          2112 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/expand/Conv2D:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv/project/BatchNorm/FusedBatchNormV3:0"] )                                    {1, 96, 112, 112}   p=f32 c=f32 o=f32   1536         6144 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/expand/BatchNorm/FusedBatchNormV3:0 ( batch_norm["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/expand/Conv2D:0"] )                             {1, 96, 112, 112}   p=f32 c=f32 o=f32   384          1536 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/expand/BatchNorm/FusedBatchNormV3:0"] )                                    {1, 96, 112, 112}   p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/expand/Relu6:0"] )                                 {1, 96, 56, 56}     p=f32 c=f32 o=f32   83040        332160 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/depthwise/BatchNorm/FusedBatchNormV3:0"] )                              {1, 96, 56, 56}     p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/depthwise/Relu6:0"] )                                {1, 24, 56, 56}     p=f32 c=f32 o=f32   2328         9312 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_2/expand/Conv2D:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/project/BatchNorm/FusedBatchNormV3:0"] )                                  {1, 144, 56, 56}    p=f32 c=f32 o=f32   3456         13824 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_2/expand/BatchNorm/FusedBatchNormV3:0 ( batch_norm["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_2/expand/Conv2D:0"] )                             {1, 144, 56, 56}    p=f32 c=f32 o=f32   576          2304 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_2/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_2/expand/BatchNorm/FusedBatchNormV3:0"] )                                    {1, 144, 56, 56}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_2/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_2/expand/Relu6:0"] )                                 {1, 144, 56, 56}    p=f32 c=f32 o=f32   186768       747072 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_2/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_2/depthwise/BatchNorm/FusedBatchNormV3:0"] )                              {1, 144, 56, 56}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_2/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_2/depthwise/Relu6:0"] )                                {1, 24, 56, 56}     p=f32 c=f32 o=f32   3480         13920 bytes
 add_0 ( add["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_2/project/BatchNorm/FusedBatchNormV3:0", "StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_1/project/BatchNorm/FusedBatchNormV3:0"] )     {1, 24, 56, 56}     p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_3/expand/BatchNorm/FusedBatchNormV3:0 ( conv["add_0"] )                                                                                                                                 {1, 144, 56, 56}    p=f32 c=f32 o=f32   3600         14400 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_3/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_3/expand/BatchNorm/FusedBatchNormV3:0"] )                                    {1, 144, 56, 56}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_3/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_3/expand/Relu6:0"] )                                 {1, 144, 28, 28}    p=f32 c=f32 o=f32   186768       747072 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_3/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_3/depthwise/BatchNorm/FusedBatchNormV3:0"] )                              {1, 144, 28, 28}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_3/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_3/depthwise/Relu6:0"] )                                {1, 32, 28, 28}     p=f32 c=f32 o=f32   4640         18560 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_4/expand/Conv2D:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_3/project/BatchNorm/FusedBatchNormV3:0"] )                                  {1, 192, 28, 28}    p=f32 c=f32 o=f32   6144         24576 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_4/expand/BatchNorm/FusedBatchNormV3:0 ( batch_norm["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_4/expand/Conv2D:0"] )                             {1, 192, 28, 28}    p=f32 c=f32 o=f32   768          3072 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_4/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_4/expand/BatchNorm/FusedBatchNormV3:0"] )                                    {1, 192, 28, 28}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_4/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_4/expand/Relu6:0"] )                                 {1, 192, 28, 28}    p=f32 c=f32 o=f32   331968       1327872 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_4/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_4/depthwise/BatchNorm/FusedBatchNormV3:0"] )                              {1, 192, 28, 28}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_4/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_4/depthwise/Relu6:0"] )                                {1, 32, 28, 28}     p=f32 c=f32 o=f32   6176         24704 bytes
 add_1 ( add["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_4/project/BatchNorm/FusedBatchNormV3:0", "StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_3/project/BatchNorm/FusedBatchNormV3:0"] )     {1, 32, 28, 28}     p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_5/expand/BatchNorm/FusedBatchNormV3:0 ( conv["add_1"] )                                                                                                                                 {1, 192, 28, 28}    p=f32 c=f32 o=f32   6336         25344 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_5/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_5/expand/BatchNorm/FusedBatchNormV3:0"] )                                    {1, 192, 28, 28}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_5/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_5/expand/Relu6:0"] )                                 {1, 192, 28, 28}    p=f32 c=f32 o=f32   331968       1327872 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_5/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_5/depthwise/BatchNorm/FusedBatchNormV3:0"] )                              {1, 192, 28, 28}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_5/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_5/depthwise/Relu6:0"] )                                {1, 32, 28, 28}     p=f32 c=f32 o=f32   6176         24704 bytes
 add_2 ( add["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_5/project/BatchNorm/FusedBatchNormV3:0", "add_1"] )                                                                                                                        {1, 32, 28, 28}     p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_6/expand/BatchNorm/FusedBatchNormV3:0 ( conv["add_2"] )                                                                                                                                 {1, 192, 28, 28}    p=f32 c=f32 o=f32   6336         25344 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_6/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_6/expand/BatchNorm/FusedBatchNormV3:0"] )                                    {1, 192, 28, 28}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_6/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_6/expand/Relu6:0"] )                                 {1, 192, 14, 14}    p=f32 c=f32 o=f32   331968       1327872 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_6/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_6/depthwise/BatchNorm/FusedBatchNormV3:0"] )                              {1, 192, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_6/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_6/depthwise/Relu6:0"] )                                {1, 64, 14, 14}     p=f32 c=f32 o=f32   12352        49408 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_7/expand/Conv2D:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_6/project/BatchNorm/FusedBatchNormV3:0"] )                                  {1, 384, 14, 14}    p=f32 c=f32 o=f32   24576        98304 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_7/expand/BatchNorm/FusedBatchNormV3:0 ( batch_norm["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_7/expand/Conv2D:0"] )                             {1, 384, 14, 14}    p=f32 c=f32 o=f32   1536         6144 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_7/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_7/expand/BatchNorm/FusedBatchNormV3:0"] )                                    {1, 384, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_7/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_7/expand/Relu6:0"] )                                 {1, 384, 14, 14}    p=f32 c=f32 o=f32   1327488      5309952 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_7/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_7/depthwise/BatchNorm/FusedBatchNormV3:0"] )                              {1, 384, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_7/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_7/depthwise/Relu6:0"] )                                {1, 64, 14, 14}     p=f32 c=f32 o=f32   24640        98560 bytes
 add_3 ( add["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_7/project/BatchNorm/FusedBatchNormV3:0", "StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_6/project/BatchNorm/FusedBatchNormV3:0"] )     {1, 64, 14, 14}     p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_8/expand/BatchNorm/FusedBatchNormV3:0 ( conv["add_3"] )                                                                                                                                 {1, 384, 14, 14}    p=f32 c=f32 o=f32   24960        99840 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_8/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_8/expand/BatchNorm/FusedBatchNormV3:0"] )                                    {1, 384, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_8/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_8/expand/Relu6:0"] )                                 {1, 384, 14, 14}    p=f32 c=f32 o=f32   1327488      5309952 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_8/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_8/depthwise/BatchNorm/FusedBatchNormV3:0"] )                              {1, 384, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_8/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_8/depthwise/Relu6:0"] )                                {1, 64, 14, 14}     p=f32 c=f32 o=f32   24640        98560 bytes
 add_4 ( add["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_8/project/BatchNorm/FusedBatchNormV3:0", "add_3"] )                                                                                                                        {1, 64, 14, 14}     p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_9/expand/BatchNorm/FusedBatchNormV3:0 ( conv["add_4"] )                                                                                                                                 {1, 384, 14, 14}    p=f32 c=f32 o=f32   24960        99840 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_9/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_9/expand/BatchNorm/FusedBatchNormV3:0"] )                                    {1, 384, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_9/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_9/expand/Relu6:0"] )                                 {1, 384, 14, 14}    p=f32 c=f32 o=f32   1327488      5309952 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_9/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_9/depthwise/BatchNorm/FusedBatchNormV3:0"] )                              {1, 384, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_9/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_9/depthwise/Relu6:0"] )                                {1, 64, 14, 14}     p=f32 c=f32 o=f32   24640        98560 bytes
 add_5 ( add["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_9/project/BatchNorm/FusedBatchNormV3:0", "add_4"] )                                                                                                                        {1, 64, 14, 14}     p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_10/expand/BatchNorm/FusedBatchNormV3:0 ( conv["add_5"] )                                                                                                                                {1, 384, 14, 14}    p=f32 c=f32 o=f32   24960        99840 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_10/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_10/expand/BatchNorm/FusedBatchNormV3:0"] )                                  {1, 384, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_10/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_10/expand/Relu6:0"] )                               {1, 384, 14, 14}    p=f32 c=f32 o=f32   1327488      5309952 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_10/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_10/depthwise/BatchNorm/FusedBatchNormV3:0"] )                            {1, 384, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_10/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_10/depthwise/Relu6:0"] )                              {1, 96, 14, 14}     p=f32 c=f32 o=f32   36960        147840 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_11/expand/Conv2D:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_10/project/BatchNorm/FusedBatchNormV3:0"] )                                {1, 576, 14, 14}    p=f32 c=f32 o=f32   55296        221184 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_11/expand/BatchNorm/FusedBatchNormV3:0 ( batch_norm["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_11/expand/Conv2D:0"] )                           {1, 576, 14, 14}    p=f32 c=f32 o=f32   2304         9216 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_11/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_11/expand/BatchNorm/FusedBatchNormV3:0"] )                                  {1, 576, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_11/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_11/expand/Relu6:0"] )                               {1, 576, 14, 14}    p=f32 c=f32 o=f32   2986560      11946240 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_11/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_11/depthwise/BatchNorm/FusedBatchNormV3:0"] )                            {1, 576, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_11/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_11/depthwise/Relu6:0"] )                              {1, 96, 14, 14}     p=f32 c=f32 o=f32   55392        221568 bytes
 add_6 ( add["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_11/project/BatchNorm/FusedBatchNormV3:0", "StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_10/project/BatchNorm/FusedBatchNormV3:0"] )   {1, 96, 14, 14}     p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_12/expand/BatchNorm/FusedBatchNormV3:0 ( conv["add_6"] )                                                                                                                                {1, 576, 14, 14}    p=f32 c=f32 o=f32   55872        223488 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_12/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_12/expand/BatchNorm/FusedBatchNormV3:0"] )                                  {1, 576, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_12/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_12/expand/Relu6:0"] )                               {1, 576, 14, 14}    p=f32 c=f32 o=f32   2986560      11946240 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_12/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_12/depthwise/BatchNorm/FusedBatchNormV3:0"] )                            {1, 576, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_12/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_12/depthwise/Relu6:0"] )                              {1, 96, 14, 14}     p=f32 c=f32 o=f32   55392        221568 bytes
 add_7 ( add["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_12/project/BatchNorm/FusedBatchNormV3:0", "add_6"] )                                                                                                                       {1, 96, 14, 14}     p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_13/expand/BatchNorm/FusedBatchNormV3:0 ( conv["add_7"] )                                                                                                                                {1, 576, 14, 14}    p=f32 c=f32 o=f32   55872        223488 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_13/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_13/expand/BatchNorm/FusedBatchNormV3:0"] )                                  {1, 576, 14, 14}    p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_13/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_13/expand/Relu6:0"] )                               {1, 576, 7, 7}      p=f32 c=f32 o=f32   2986560      11946240 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_13/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_13/depthwise/BatchNorm/FusedBatchNormV3:0"] )                            {1, 576, 7, 7}      p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_13/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_13/depthwise/Relu6:0"] )                              {1, 160, 7, 7}      p=f32 c=f32 o=f32   92320        369280 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/expand/Conv2D:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_13/project/BatchNorm/FusedBatchNormV3:0"] )                                {1, 960, 7, 7}      p=f32 c=f32 o=f32   153600       614400 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/expand/BatchNorm/FusedBatchNormV3:0 ( batch_norm["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/expand/Conv2D:0"] )                           {1, 960, 7, 7}      p=f32 c=f32 o=f32   3840         15360 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/expand/BatchNorm/FusedBatchNormV3:0"] )                                  {1, 960, 7, 7}      p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/expand/Relu6:0"] )                               {1, 960, 7, 7}      p=f32 c=f32 o=f32   8295360      33181440 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/depthwise/BatchNorm/FusedBatchNormV3:0"] )                            {1, 960, 7, 7}      p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/depthwise/Relu6:0"] )                              {1, 160, 7, 7}      p=f32 c=f32 o=f32   153760       615040 bytes
 add_8 ( add["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_14/project/BatchNorm/FusedBatchNormV3:0", "StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_13/project/BatchNorm/FusedBatchNormV3:0"] )   {1, 160, 7, 7}      p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_15/expand/BatchNorm/FusedBatchNormV3:0 ( conv["add_8"] )                                                                                                                                {1, 960, 7, 7}      p=f32 c=f32 o=f32   154560       618240 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_15/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_15/expand/BatchNorm/FusedBatchNormV3:0"] )                                  {1, 960, 7, 7}      p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_15/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_15/expand/Relu6:0"] )                               {1, 960, 7, 7}      p=f32 c=f32 o=f32   8295360      33181440 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_15/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_15/depthwise/BatchNorm/FusedBatchNormV3:0"] )                            {1, 960, 7, 7}      p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_15/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_15/depthwise/Relu6:0"] )                              {1, 160, 7, 7}      p=f32 c=f32 o=f32   153760       615040 bytes
 add_9 ( add["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_15/project/BatchNorm/FusedBatchNormV3:0", "add_8"] )                                                                                                                       {1, 160, 7, 7}      p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_16/expand/BatchNorm/FusedBatchNormV3:0 ( conv["add_9"] )                                                                                                                                {1, 960, 7, 7}      p=f32 c=f32 o=f32   154560       618240 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_16/expand/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_16/expand/BatchNorm/FusedBatchNormV3:0"] )                                  {1, 960, 7, 7}      p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_16/depthwise/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_16/expand/Relu6:0"] )                               {1, 960, 7, 7}      p=f32 c=f32 o=f32   8295360      33181440 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_16/depthwise/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_16/depthwise/BatchNorm/FusedBatchNormV3:0"] )                            {1, 960, 7, 7}      p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_16/project/BatchNorm/FusedBatchNormV3:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_16/depthwise/Relu6:0"] )                              {1, 320, 7, 7}      p=f32 c=f32 o=f32   307520       1230080 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv_1/Conv2D:0 ( conv["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/expanded_conv_16/project/BatchNorm/FusedBatchNormV3:0"] )                                                 {1, 1280, 7, 7}     p=f32 c=f32 o=f32   409600       1638400 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv_1/BatchNorm/FusedBatchNormV3:0 ( batch_norm["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv_1/Conv2D:0"] )                                                             {1, 1280, 7, 7}     p=f32 c=f32 o=f32   5120         20480 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv_1/Relu6:0 ( clip["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv_1/BatchNorm/FusedBatchNormV3:0"] )                                                                    {1, 1280, 7, 7}     p=f32 c=f32 o=f32   0            0 bytes
 StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Logits/AvgPool:0 ( avg_pool["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Conv_1/Relu6:0"] )                                                                                   {1, 1280, 1, 1}     p=f32 c=f32 o=f32   0            0 bytes
 feature_vector ( squeeze["StatefulPartitionedCall/StatefulPartitionedCall/predict/MobilenetV2/Logits/AvgPool:0"] )                                                                                                                                                        {1, 1280}           p=f32 c=f32 o=f32   0            0 bytes
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
seanmor5 commented 2 years ago

Oh this is a bug because AxonOnnx does not handle cases where the input configuration uses a channels: :last configuration! This means we will have to update all pooling operations, conv operations, and normalization to handle channels last. Let me do some research to see how we can get this information from ONNX or infer it from the input. Also, go birds!

jallum commented 2 years ago

i'd be happy to put in some time to get this working if you don't mind explaining what you have in mind. (i applied to the slack channel, but am waiting for approval)

jallum commented 2 years ago

so, I re-exported my model using a flag that is supposed to rearrange the inputs, like so:

python -m tf2onnx.convert --saved-model ./imagenet_mobilenet_v2_100_224_feature_vector_5 --opset 15 --output imagenet_mobilenet_v2_100_224_feature_vector_5.onnx --inputs-as-nchw inputs

..and i changed the image loading code in my livebook around, like so:

{:ok, image} =
  cards
  |> Enum.random()
  |> Pixels.read_file()

input = 
  image.data
  |> Nx.from_binary({:u, 8})
  |> Nx.reshape({image.height, image.width, 4}, names: [:width, :height, :channels]) # RGBA
  |> Nx.slice([0, 0, 0], [224, 224, 3]) # Discard the alpha channel
  |> Nx.transpose(axes: [:channels, :height, :width]) # <--- added this
  |> Nx.divide(255.0)

...rerun, and i get the exact same error -- the problem might be something else?

jallum commented 2 years ago

upon further investigation, it looks like deserialization for "Conv" isn't dealing with depth-wise convolutions properly. thoughts?

seanmor5 commented 2 years ago

Ahhh I did not realize those were supposed to be depthwise convolutions --- so what you can try is if the ONNX groups option is not equal to 1, you can make it an Axon.depthwise_conv...though I'm still a little surprised the original conv is failing because it is setting feature_group_size.

jallum commented 2 years ago

yep. depthwise conv is used quite a bit on this kind of model. anyway, i made the simplistic change to using Axon.depthwise_conv when group > 1, and after seven minutes(!) of runtime, no crash -- i get an answer. I'm wondering if any of these other parameters need to be tweaked? anyway, there's a PR up for this and we can move the discussion there.

jallum commented 2 years ago

I'll compare the answer I get with a reference in python and see if it's ballpark-ish correct. if so, then it's just a matter of making it run faster -- should be subsecond, not minutes for this model.

seanmor5 commented 2 years ago

@jallum Are you specfying compiler: EXLA in Axon.predict? Additionally, there was a recent update to the Axon compiler which should speed up inference times significantly, try to delete AxonOnnx's mix.lock and then re-run mix deps.get and see if inference is indeed faster

jallum commented 2 years ago

no, i was not -- now that i have, it's subsecond, as expected. (i was already on the latest axon.) woo!

jallum commented 2 years ago

Fixed on master.