{"action":"created","issue":{"url":"https://api.github.com/repos/cs231n/cs231n.github.io/issues/41","labels_url":"https://api.github.com/repos/cs231n/cs231n.github.io/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/cs231n/cs231n.github.io/issues/41/comments","events_url":"https://api.github.com/repos/cs231n/cs231n.github.io/issues/41/events","html_url":"https://github.com/cs231n/cs231n.github.io/issues/41","id":92472023,"number":41,"title":"Gradient calculation incorrect?  perhaps?","user":{"login":"ArEnSc","id":6252325,"avatar_url":"https://avatars.githubusercontent.com/u/6252325?v=3","gravatar_id":"","url":"https://api.github.com/users/ArEnSc","html_url":"https://github.com/ArEnSc","followers_url":"https://api.github.com/users/ArEnSc/followers","following_url":"https://api.github.com/users/ArEnSc/following{/other_user}","gists_url":"https://api.github.com/users/ArEnSc/gists{/gist_id}","starred_url":"https://api.github.com/users/ArEnSc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArEnSc/subscriptions","organizations_url":"https://api.github.com/users/ArEnSc/orgs","repos_url":"https://api.github.com/users/ArEnSc/repos","events_url":"https://api.github.com/users/ArEnSc/events{/privacy}","received_events_url":"https://api.github.com/users/ArEnSc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-01T19:58:29Z","updated_at":"2015-07-01T22:30:55Z","closed_at":null,"body":"http://cs231n.github.io/optimization-2/\r\n\r\n```python\r\n# set some inputs\r\nx = -2; y = 5; z = -4\r\n\r\n# perform the forward pass\r\nq = x + y # q becomes 3\r\nf = q * z # f becomes -12\r\n\r\n# perform the backward pass (backpropagation) in reverse order:\r\n# first backprop through f = q * z\r\ndfdz = q # df/dz = q, so gradient on z becomes 3\r\ndfdq = z # df/dq = z, so gradient on q becomes -4\r\n# now backprop through q = x + y\r\ndfdx = 1.0 * dfdq # dq/dx = 1. And the multiplication here is the chain rule!\r\ndfdy = 1.0 * dfdq # dq/dy = 1\r\n\r\n```\r\n\r\ndfdx = 1.0 * dfdq # dq/dx = 1. And the multiplication here is the chain rule!\r\ndfdy = 1.0 * dfdq \r\n\r\nShouldn't the above be -4 ? \r\n\r\nIn the circuit diagram it's not immediately clear where the final 1 comes from?\r\n\r\nAlso isn't the partial derivative of f(x,y,z) with respect to x = z?  also that of y.\r\nJust to make sure I am not crazy I punched into wolfram.\r\nhttp://www.wolframalpha.com/widgets/view.jsp?id=d052b64db910c143ed1f1a05298ba14c \r\n\r\nso I get\r\n\r\nfx = z\r\nfy = z\r\nfz = x + y\r\n\r\nmeaning the gradient is\r\n\r\nfxyz = [z,z,x+y]\r\n\r\nso for the inputs\r\ngradient is fxyz = [-4,-4,3] ?\r\n\r\nI am sorry I am not sure if the mistake is on my end.\r\n\r\nThanks and let me know ? =)\r\n\r\nIf you can explain to me where the 1 comes from as well that would be great =)\r\nwould it be the length of the final vector? \r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/cs231n/cs231n.github.io/issues/comments/117841712","html_url":"https://github.com/cs231n/cs231n.github.io/issues/41#issuecomment-117841712","issue_url":"https://api.github.com/repos/cs231n/cs231n.github.io/issues/41","id":117841712,"user":{"login":"ArEnSc","id":6252325,"avatar_url":"https://avatars.githubusercontent.com/u/6252325?v=3","gravatar_id":"","url":"https://api.github.com/users/ArEnSc","html_url":"https://github.com/ArEnSc","followers_url":"https://api.github.com/users/ArEnSc/followers","following_url":"https://api.github.com/users/ArEnSc/following{/other_user}","gists_url":"https://api.github.com/users/ArEnSc/gists{/gist_id}","starred_url":"https://api.github.com/users/ArEnSc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArEnSc/subscriptions","organizations_url":"https://api.github.com/users/ArEnSc/orgs","repos_url":"https://api.github.com/users/ArEnSc/repos","events_url":"https://api.github.com/users/ArEnSc/events{/privacy}","received_events_url":"https://api.github.com/users/ArEnSc/received_events","type":"User","site_admin":false},"created_at":"2015-07-01T22:30:55Z","updated_at":"2015-07-01T22:30:55Z","body":"Alright so I have a better understanding, what you are trying to communicate you are trying to say that we in order to understand back prorogation we need to see it happen at each pass. I am still not sure where the 1 comes from though."}}