{"action":"closed","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/13885","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/13885/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/13885/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/13885/events","html_url":"https://github.com/tensorflow/tensorflow/issues/13885","id":267399714,"number":13885,"title":"tf.reduce_mean is not compatible with np.mean","user":{"login":"amirj","id":1645137,"avatar_url":"https://avatars2.githubusercontent.com/u/1645137?v=4","gravatar_id":"","url":"https://api.github.com/users/amirj","html_url":"https://github.com/amirj","followers_url":"https://api.github.com/users/amirj/followers","following_url":"https://api.github.com/users/amirj/following{/other_user}","gists_url":"https://api.github.com/users/amirj/gists{/gist_id}","starred_url":"https://api.github.com/users/amirj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amirj/subscriptions","organizations_url":"https://api.github.com/users/amirj/orgs","repos_url":"https://api.github.com/users/amirj/repos","events_url":"https://api.github.com/users/amirj/events{/privacy}","received_events_url":"https://api.github.com/users/amirj/received_events","type":"User","site_admin":false},"labels":[{"id":299643928,"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/stat:contributions%20welcome","name":"stat:contributions welcome","color":"009800","default":false},{"id":284443156,"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/type:docs","name":"type:docs","color":"c7def8","default":false}],"state":"closed","locked":false,"assignee":{"login":"MarkDaoust","id":1414837,"avatar_url":"https://avatars1.githubusercontent.com/u/1414837?v=4","gravatar_id":"","url":"https://api.github.com/users/MarkDaoust","html_url":"https://github.com/MarkDaoust","followers_url":"https://api.github.com/users/MarkDaoust/followers","following_url":"https://api.github.com/users/MarkDaoust/following{/other_user}","gists_url":"https://api.github.com/users/MarkDaoust/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkDaoust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkDaoust/subscriptions","organizations_url":"https://api.github.com/users/MarkDaoust/orgs","repos_url":"https://api.github.com/users/MarkDaoust/repos","events_url":"https://api.github.com/users/MarkDaoust/events{/privacy}","received_events_url":"https://api.github.com/users/MarkDaoust/received_events","type":"User","site_admin":false},"assignees":[{"login":"MarkDaoust","id":1414837,"avatar_url":"https://avatars1.githubusercontent.com/u/1414837?v=4","gravatar_id":"","url":"https://api.github.com/users/MarkDaoust","html_url":"https://github.com/MarkDaoust","followers_url":"https://api.github.com/users/MarkDaoust/followers","following_url":"https://api.github.com/users/MarkDaoust/following{/other_user}","gists_url":"https://api.github.com/users/MarkDaoust/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkDaoust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkDaoust/subscriptions","organizations_url":"https://api.github.com/users/MarkDaoust/orgs","repos_url":"https://api.github.com/users/MarkDaoust/repos","events_url":"https://api.github.com/users/MarkDaoust/events{/privacy}","received_events_url":"https://api.github.com/users/MarkDaoust/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2017-10-21T17:39:20Z","updated_at":"2017-12-21T15:27:25Z","closed_at":"2017-12-21T15:27:25Z","author_association":"CONTRIBUTOR","body":"[tf.reduce_mean](https://www.tensorflow.org/api_docs/python/tf/reduce_mean) emphasized that this function is compatible with numpy:\r\n\r\n> Equivalent to np.mean\r\n\r\nBut it doesn't in the output type. Consider the following code for example:\r\n\r\n```\r\nimport tensorflow as tf\r\nx = tf.Variable([1, 0, 1, 0])\r\ninit = tf.global_variables_initializer()\r\nsess = tf.Session()\r\nsess.run(init)\r\nprint(sess.run(tf.reduce_mean(x)))\r\n\r\n```\r\n\r\nThe output is zero. It seems that tf.reduce_mean infer the output type from the input tensor because casting the input tensor to float values, solve the problem. This attribute is not compatible to np.mean:\r\n\r\n```\r\nimport numpy as np\r\nprint(np.mean([1,0,0,1]))\r\n```\r\n\r\n\r\n### System information\r\n- **OS Platform and Distribution**: Linux Ubuntu 16.04\r\n- **TensorFlow installed from (source or binary)**: Source\r\n- **TensorFlow version (use command below)**: 1.3\r\n- **Python version**: 3.6\r\n"}}
{"actor":{"display_login":"MarkDaoust"}}