{"action":"created","issue":{"url":"https://api.github.com/repos/schelotto/Wasserstein_Autoencoders/issues/2","repository_url":"https://api.github.com/repos/schelotto/Wasserstein_Autoencoders","labels_url":"https://api.github.com/repos/schelotto/Wasserstein_Autoencoders/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/schelotto/Wasserstein_Autoencoders/issues/2/comments","events_url":"https://api.github.com/repos/schelotto/Wasserstein_Autoencoders/issues/2/events","html_url":"https://github.com/schelotto/Wasserstein_Autoencoders/issues/2","id":347495986,"node_id":"MDU6SXNzdWUzNDc0OTU5ODY=","number":2,"title":"mmd_loss.backward() gets an error","user":{"login":"ahmed-fau","id":39087983,"node_id":"MDQ6VXNlcjM5MDg3OTgz","avatar_url":"https://avatars2.githubusercontent.com/u/39087983?v=4","gravatar_id":"","url":"https://api.github.com/users/ahmed-fau","html_url":"https://github.com/ahmed-fau","followers_url":"https://api.github.com/users/ahmed-fau/followers","following_url":"https://api.github.com/users/ahmed-fau/following{/other_user}","gists_url":"https://api.github.com/users/ahmed-fau/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmed-fau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmed-fau/subscriptions","organizations_url":"https://api.github.com/users/ahmed-fau/orgs","repos_url":"https://api.github.com/users/ahmed-fau/repos","events_url":"https://api.github.com/users/ahmed-fau/events{/privacy}","received_events_url":"https://api.github.com/users/ahmed-fau/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-03T18:33:48Z","updated_at":"2018-08-06T10:34:27Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI am encountering the following error when backwarding through the mmd_loss function\r\n\r\n'Traceback (most recent call last):\r\n  File \"wae.py\", line 570, in <module>\r\n    mmd_loss.mean().backward(retain_graph=True)\r\n  File \"/home/amust/toolchain/lib/python3.5/site-packages/torch/tensor.py\", line 93, in backward\r\n    torch.autograd.backward(self, gradient, retain_graph, create_graph)\r\n  File \"/home/amust/toolchain/lib/python3.5/site-packages/torch/autograd/__init__.py\", line 89, in backward\r\n    allow_unreachable=True)  # allow_unreachable flag\r\nRuntimeError: Trying to backward through the graph a second time, but the buffers have already been freed. Specify retain_graph=True when calling backward the first time.'\r\n\r\nAny help to fix this ?\r\n\r\nBest Regards"},"comment":{"url":"https://api.github.com/repos/schelotto/Wasserstein_Autoencoders/issues/comments/410665117","html_url":"https://github.com/schelotto/Wasserstein_Autoencoders/issues/2#issuecomment-410665117","issue_url":"https://api.github.com/repos/schelotto/Wasserstein_Autoencoders/issues/2","id":410665117,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMDY2NTExNw==","user":{"login":"ahmed-fau","id":39087983,"node_id":"MDQ6VXNlcjM5MDg3OTgz","avatar_url":"https://avatars2.githubusercontent.com/u/39087983?v=4","gravatar_id":"","url":"https://api.github.com/users/ahmed-fau","html_url":"https://github.com/ahmed-fau","followers_url":"https://api.github.com/users/ahmed-fau/followers","following_url":"https://api.github.com/users/ahmed-fau/following{/other_user}","gists_url":"https://api.github.com/users/ahmed-fau/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmed-fau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmed-fau/subscriptions","organizations_url":"https://api.github.com/users/ahmed-fau/orgs","repos_url":"https://api.github.com/users/ahmed-fau/repos","events_url":"https://api.github.com/users/ahmed-fau/events{/privacy}","received_events_url":"https://api.github.com/users/ahmed-fau/received_events","type":"User","site_admin":false},"created_at":"2018-08-06T10:34:27Z","updated_at":"2018-08-06T10:34:27Z","author_association":"NONE","body":"I think that I have got the solution:\r\n\r\nthe backward function of the reconstruction loss (recon_loss.backward(one)) should be called with argument 'retain_graph=True'. Otherwise, the computation graph for the encoder would be freed and the mmd_loss backward function will raise an error.\r\n\r\nso:\r\n\r\nreconstruction_loss.backward(retain_graph=True)\r\nmmd_loss.mean().backward()"}}
{"actor":{"display_login":"ahmed-fau"}}