{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/3767","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/3767/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/3767/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/3767/events","html_url":"https://github.com/tensorflow/tensorflow/issues/3767","id":170844353,"number":3767,"title":"Incorrect Hessian of the tf.nn.sigmoid function","user":{"login":"cjf00000","id":1835387,"avatar_url":"https://avatars.githubusercontent.com/u/1835387?v=3","gravatar_id":"","url":"https://api.github.com/users/cjf00000","html_url":"https://github.com/cjf00000","followers_url":"https://api.github.com/users/cjf00000/followers","following_url":"https://api.github.com/users/cjf00000/following{/other_user}","gists_url":"https://api.github.com/users/cjf00000/gists{/gist_id}","starred_url":"https://api.github.com/users/cjf00000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjf00000/subscriptions","organizations_url":"https://api.github.com/users/cjf00000/orgs","repos_url":"https://api.github.com/users/cjf00000/repos","events_url":"https://api.github.com/users/cjf00000/events{/privacy}","received_events_url":"https://api.github.com/users/cjf00000/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/contributions%20welcome","name":"contributions welcome","color":"009800"},{"url":"https://api.github.com/repos/tensorflow/tensorflow/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-12T10:36:32Z","updated_at":"2016-08-12T15:09:27Z","closed_at":null,"body":"GitHub issues are for bugs / installation problems / feature requests.  \r\nFor general support from the community, see [StackOverflow](https://stackoverflow.com/questions/tagged/tensorflow).\r\nTo make bugs and feature requests more easy to find and organize, we close issues that are deemed\r\nout of scope for GitHub Issues and point people to StackOverflow.\r\n\r\nFor bugs or installation issues, please provide the following information.\r\nThe more information you provide, the more easily we will be able to offer\r\nhelp and advice.\r\n\r\n### Environment info\r\nOperating System: Linux 3.13.0-85-generic #129-Ubuntu SMP Thu Mar 17 20:50:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux\r\n\r\nInstalled version of CUDA and cuDNN: \r\n(please attach the output of `ls -l /path/to/cuda/lib/libcud*`):\r\n-rw-r--r-- 1 root root 322936 Aug 15  2015 /usr/local/cuda/lib64/libcudadevrt.a\r\nlrwxrwxrwx 1 root root     16 Aug 15  2015 /usr/local/cuda/lib64/libcudart.so -> libcudart.so.7.5\r\nlrwxrwxrwx 1 root root     19 Aug 15  2015 /usr/local/cuda/lib64/libcudart.so.7.5 -> libcudart.so.7.5.18\r\n-rwxr-xr-x 1 root root 383336 Aug 15  2015 /usr/local/cuda/lib64/libcudart.so.7.5.18\r\n-rw-r--r-- 1 root root 720192 Aug 15  2015 /usr/local/cuda/lib64/libcudart_static.a\r\n\r\nIf installed from binary pip package, provide:\r\n\r\n1. Which pip package you installed.\r\ntensorflow\r\n\r\n2. The output from `python -c \"import tensorflow; print(tensorflow.__version__)\"`.\r\n0.10.0rc0\r\n\r\nIf installed from source, provide \r\n\r\n1. The commit hash (`git rev-parse HEAD`)\r\n2. The output of `bazel version`\r\n\r\n### Steps to reproduce\r\nI am trying to evaluate hessian of a logistic function via the following program.\r\n```\r\n# x = 1\r\n# logistic(x) = 0.7310585786300049\r\n# gradient(x) = logistic(x) * (1 - logistic(x)) = 0.19661193324148185\r\n# hessian(x) = logistic(x) * (1 - logistic(x)) ^ 2 + -logistic(x) * (1 - logistic(x)) * logistic(x) = -0.09085774767294841\r\nimport tensorflow as tf\r\n\r\nx = tf.Variable(1, name='x', dtype=tf.float32)\r\n#logistic = 1. / (1 + tf.exp(-x))\r\nlogistic = tf.nn.sigmoid(x, name='logistic')\r\n\r\ngradient = tf.gradients(logistic, x, name='gradient')[0]\r\nhessian = tf.gradients(gradient, x, name='hessian')[0]\r\n\r\nsess = tf.Session()\r\nsess.run(tf.initialize_all_variables())\r\nprint(sess.run([logistic, gradient, hessian]))\r\n```\r\n\r\nI directly run the program, it produce the wrong result. \r\n\r\n```TypeError: Fetch argument None of None has invalid type <type 'NoneType'>, must be a string or Tensor```\r\n\r\nIt seems that `hessian` is `None`.\r\n\r\nHowever, if I write the logistic function manually `logistic = 1. / (1 + tf.exp(-x))`, it produces the correct result.  `[0.7310586, 0.19661197, -0.090857767]`\r\n\r\n### What have you tried?\r\n1.\r\n\r\n### Logs or other output that would be helpful\r\n(If logs are large, please upload as attachment).\r\n"},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/239472444","html_url":"https://github.com/tensorflow/tensorflow/issues/3767#issuecomment-239472444","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/3767","id":239472444,"user":{"login":"girving","id":70511,"avatar_url":"https://avatars.githubusercontent.com/u/70511?v=3","gravatar_id":"","url":"https://api.github.com/users/girving","html_url":"https://github.com/girving","followers_url":"https://api.github.com/users/girving/followers","following_url":"https://api.github.com/users/girving/following{/other_user}","gists_url":"https://api.github.com/users/girving/gists{/gist_id}","starred_url":"https://api.github.com/users/girving/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/girving/subscriptions","organizations_url":"https://api.github.com/users/girving/orgs","repos_url":"https://api.github.com/users/girving/repos","events_url":"https://api.github.com/users/girving/events{/privacy}","received_events_url":"https://api.github.com/users/girving/received_events","type":"User","site_admin":false},"created_at":"2016-08-12T15:09:27Z","updated_at":"2016-08-12T15:09:27Z","body":"To clarify: there's no need to make new custom ops.  A few lines of Python writing the gradient of these two routines in terms of other existing ops suffices."}}
{"actor":{"display_login":"girving"}}