{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/serving/issues/276","repository_url":"https://api.github.com/repos/tensorflow/serving","labels_url":"https://api.github.com/repos/tensorflow/serving/issues/276/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/serving/issues/276/comments","events_url":"https://api.github.com/repos/tensorflow/serving/issues/276/events","html_url":"https://github.com/tensorflow/serving/issues/276","id":195858605,"number":276,"title":"Batched output tensor's 0th dimension does not equal the sum of the 0th dimension sizes of the input tensors","user":{"login":"anandanand84","id":5538452,"avatar_url":"https://avatars.githubusercontent.com/u/5538452?v=3","gravatar_id":"","url":"https://api.github.com/users/anandanand84","html_url":"https://github.com/anandanand84","followers_url":"https://api.github.com/users/anandanand84/followers","following_url":"https://api.github.com/users/anandanand84/following{/other_user}","gists_url":"https://api.github.com/users/anandanand84/gists{/gist_id}","starred_url":"https://api.github.com/users/anandanand84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anandanand84/subscriptions","organizations_url":"https://api.github.com/users/anandanand84/orgs","repos_url":"https://api.github.com/users/anandanand84/repos","events_url":"https://api.github.com/users/anandanand84/events{/privacy}","received_events_url":"https://api.github.com/users/anandanand84/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-15T16:58:37Z","updated_at":"2016-12-15T18:51:51Z","closed_at":null,"body":"Batched output tensor's 0th dimension does not equal the sum of the 0th dimension sizes of the input tensor error occurs when using the tensorflow model_server PredictionService. Below is my export variables in python.\r\n\r\n\r\n```\r\n    imagesize = 400;\r\n    x = tf.placeholder(tf.float32, [None, imagesize], name=\"x_placeholder\")\r\n    y = tf.placeholder(tf.float32, [None, labelscount], name=\"y_placeholder\")\r\n```\r\n\r\n### Inference\r\n\r\n```\r\n    pred = conv_net(x, weights, biases, keep_prob)\r\n    actual = tf.cast(tf.argmax(pred, 1), tf.int32); \r\n    output = tf.reshape(tf.gather(availableClasses, actual), [-1,1])\r\n    probability = tf.reshape(tf.reduce_max(tf.nn.softmax(pred), 1), [-1,1])\r\n```\r\n### Export\r\n```\r\n    export_saver = tf.train.Saver(sharded=True)\r\n    model_exporter = exporter.Exporter(export_saver)\r\n    model_exporter.init(sess.graph.as_graph_def(), named_graph_signatures={\r\n        'inputs': exporter.generic_signature({'images': x}),\r\n        'outputs': exporter.generic_signature({'classes': output , 'probability' : probability})})\r\n    model_exporter.export(export_path, tf.constant(export_version), sess)\r\n```\r\n\r\nThe inferance happens fine without batching(--enable-batching), but when batching is enabled it fails with error mentioned below.\r\n\r\n```\r\n    { Error: Batched output tensor's 0th dimension does not equal the sum of the 0th dimension sizes of the input tensors\r\n        at /Users/anandmac/dev/projects/serving-client/node_modules/grpc/src/node/src/client.js:417:17 code: 9, metadata: Metadata { _internal_repr: {} } }\r\n```\r\n\r\nBelow is the grpc proto used to call the predict.\r\n\r\n```\r\n    {\r\n        model_spec: { name: 'patterndetector' },\r\n        inputs: {\r\n            images: {\r\n            dtype: 'DT_FLOAT',\r\n            tensor_shape: {\r\n                dim: {\r\n                    size : 1 # I have tried 0, 1 , -1 without any luck\r\n                },\r\n                dim: {\r\n                    size: values.length\r\n                }\r\n            },\r\n            float_val: values\r\n            }\r\n        }\r\n    };\r\n```\r\nWhen I run it in python without tensorflow-model-server and print the shape of input, output and probability \r\nI get the below result which has the same dimension in 0th place\r\n\r\n```\r\n    result, prob =  sess.run([output, probability], feed_dict={x: batch_xs, keep_prob : 1.0} );\r\n    print(tf.constant(np.zeros([10,400])).get_shape()); #(10, 400)\r\n    print(result.shape); #(10, 1)\r\n    print(prob.shape); #(10, 1)\r\n```\r\n\r\n what does the error message mean if it occurs even if the dimension are correct."},"comment":{"url":"https://api.github.com/repos/tensorflow/serving/issues/comments/267409133","html_url":"https://github.com/tensorflow/serving/issues/276#issuecomment-267409133","issue_url":"https://api.github.com/repos/tensorflow/serving/issues/276","id":267409133,"user":{"login":"chrisolston","id":17073551,"avatar_url":"https://avatars.githubusercontent.com/u/17073551?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisolston","html_url":"https://github.com/chrisolston","followers_url":"https://api.github.com/users/chrisolston/followers","following_url":"https://api.github.com/users/chrisolston/following{/other_user}","gists_url":"https://api.github.com/users/chrisolston/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisolston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisolston/subscriptions","organizations_url":"https://api.github.com/users/chrisolston/orgs","repos_url":"https://api.github.com/users/chrisolston/repos","events_url":"https://api.github.com/users/chrisolston/events{/privacy}","received_events_url":"https://api.github.com/users/chrisolston/received_events","type":"User","site_admin":false},"created_at":"2016-12-15T18:51:51Z","updated_at":"2016-12-15T18:51:51Z","body":"The batching code has been pounded on quite a bit so if there was a basic bug in there like that I think we would have found it already. That said, we *just* pushed an update to the batching code 6 days ago, so if you're living on the bleeding edge that could explain it. The change I'm referring to is https://github.com/tensorflow/serving/commit/c28f2982ef7df2a06c46157f9a5cea9979cf1022."}}
{"actor":{"display_login":"chrisolston"}}