{"action":"opened","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/705","labels_url":"https://api.github.com/repos/fchollet/keras/issues/705/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/705/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/705/events","html_url":"https://github.com/fchollet/keras/issues/705","id":107404142,"number":705,"title":"accessing class conditional activations","user":{"login":"colincsl","id":498232,"avatar_url":"https://avatars.githubusercontent.com/u/498232?v=3","gravatar_id":"","url":"https://api.github.com/users/colincsl","html_url":"https://github.com/colincsl","followers_url":"https://api.github.com/users/colincsl/followers","following_url":"https://api.github.com/users/colincsl/following{/other_user}","gists_url":"https://api.github.com/users/colincsl/gists{/gist_id}","starred_url":"https://api.github.com/users/colincsl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colincsl/subscriptions","organizations_url":"https://api.github.com/users/colincsl/orgs","repos_url":"https://api.github.com/users/colincsl/repos","events_url":"https://api.github.com/users/colincsl/events{/privacy}","received_events_url":"https://api.github.com/users/colincsl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-20T16:50:23Z","updated_at":"2015-09-20T16:50:23Z","closed_at":null,"body":"I am wondering if there if there is a simple way to get the class conditional activations at each layer. I know you can get all activations using the following:\r\n```\r\nget_feature = []\r\nfor i in range(len(model.layers)):\r\n    get_feature +=[theano.function([model.layers[0].input],model.layers[i].get_output(train=False),allow_input_downcast=False)]\r\n\r\nfeatures = get_feature[layer_idx](X_test[:batch_size])\r\n```\r\n\r\nIn my case I only want to look at the activations for each layer that contribute to class X. I know that with the output score for class X then you can backprogate this through each layer. I would have no problem doing it by hand if it was simply a bunch of matrix multiplications. However, it gets a little messy with the convolutional and pooling layers and I don't want to manually update this every time I make a change to my network.\r\n\r\nI'm hoping you can do this with a set of Theano functions, like the ones above, to get these class conditional activations. \r\n"}}