System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): IBM Z (s390x arch), Ubuntu 18.04.04
- TensorFlow installed from (source or binary): Installed Tensorflow C lib from source
- TensorFlow version (use command below): 1.15.3
- Bazel version (if compiling from source): 0.26.1
The Problem
I installed the TensorFlow C library on an s390x machine. Then tried to do inferencing using a pre-trained model, when I encountered the following error. I'm loading the model graph from a protobuf file.
INFO[0000]/root/gopros/src/github.com/rai-project/tensorflow/vendor/github.com/rai-project/dlframework/framework/register.go:76 github.com/rai-project/tensorflow/vendor/github.com/rai-project/dlframework/framework.Register() skipping regitration of hidden model pkg=dlframework/framework name=SSD_MobileNet_v2_Quantized_300x300_COCO
INFO[0000] running predict urls model=MobileNet_v1_1.0_224 pkg=dlframework/framework/cmd/serverError: unable to create tensorflow model graph: Invalid value in tensor used for shape: -385679360
Standalone code to reproduce the issue
I suspected the error is because the protobuf file for the model graph was originally created on little-endian machine and I'm trying to load it on a big-endian machine. In order to confirm that the error is due to the loading of protobuf graph in Tensorflow, I tried out [this](https://gist.github.com/asimshankar/7c9f8a9b04323e93bb217109da8c7ad2) tutorial. Using this tutorial, I created a tensorflow model and saved it in protobuf format on an x86 system. When I loaded the graph file on an x86 system, it works but when I tried loading the graph on s390x system, I got the following error -
Loading graphRead GraphDef of 27083 bytesERROR: Dimension 0 in both shapes must be equal, but are 1 and 16777216. Shapes are [1,1] and [16777216,16777216]. for 'dense/kernel/Assign' (op: 'Assign') with input shapes: [1,1], [16777216,16777216]
Other info / logs
The following tests are passing on zLinux -
//tensorflow/c:c_api_test
//tensorflow/c:c_api_function_test
//tensorflow/c:c_test
//tensorflow/c:ops_test
//tensorflow/c:env_test
//tensorflow/c:c_test_util
//tensorflow/cc/saved_model:reader_test
//tensorflow/cc/saved_model:loader_test
------------------------------
Priyanshu Khandelwal
------------------------------