{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/2617","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/2617/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/2617/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/2617/events","html_url":"https://github.com/fchollet/keras/issues/2617","id":153141955,"number":2617,"title":"using shared variables without mucking up the computational graph","user":{"login":"braingineer","id":1455742,"avatar_url":"https://avatars.githubusercontent.com/u/1455742?v=3","gravatar_id":"","url":"https://api.github.com/users/braingineer","html_url":"https://github.com/braingineer","followers_url":"https://api.github.com/users/braingineer/followers","following_url":"https://api.github.com/users/braingineer/following{/other_user}","gists_url":"https://api.github.com/users/braingineer/gists{/gist_id}","starred_url":"https://api.github.com/users/braingineer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/braingineer/subscriptions","organizations_url":"https://api.github.com/users/braingineer/orgs","repos_url":"https://api.github.com/users/braingineer/repos","events_url":"https://api.github.com/users/braingineer/events{/privacy}","received_events_url":"https://api.github.com/users/braingineer/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-05-04T23:56:06Z","updated_at":"2016-05-05T03:14:58Z","closed_at":"2016-05-05T03:14:58Z","body":"Basically, the situation is that I want to pre-load some shared variables that don't change as I feed in data. \r\n\r\nHowever, they aren't weights or anything that I can just set to a network. They need to be computed on by the other layers, just as the data would.   and you can't just arbitrarily put things in. because the computational gets re-ran, if something isn't linked in, it won't get used.. \r\n\r\nI've tried creating my faux input layer ([found here](https://gist.github.com/braingineer/c2aa37c4bdfe7dc7691081ccf0f4941d)) which creates a Node and gets inserted into the computational graph that way, but then keras expects it to be input at run time.  \r\n\r\nevery variation on that idea (altering parts of Node, altering the variable in various places during runtime) always fails because there's some other part that assumes data can only be passed in at every iteration.  \r\n\r\nsome things I've tried and their errors:\r\n1.  the full gist above where input and output tensors are set. \r\n```\r\nFile \"/home/cogniton/research/code/keras/keras/engine/topology.py\", line 1773, in __init__\r\n    str(layers_with_complete_input))\r\nException: Graph disconnected: cannot obtain value for tensor sometensorname at layer layername. The following previous layers were accessed without issue: []\r\n```\r\n.2. Edited the thing that makes that trigger.\r\n```\r\n  File \"/home/cogniton/research/code/keras/keras/engine/topology.py\", line 2131, in run_internal_graph\r\n    assert str(id(x)) in tensor_map, 'Could not compute output ' + str(x)\r\nAssertionError: Could not compute output Reshape{3}.0\r\n```\r\n.3. maybe if i don't input the input tensor, it won't think it's input\r\n```\r\n  File \"/home/cogniton/research/code/keras/keras/engine/topology.py\", line 543, in add_inbound_node\r\n    Node.create_node(self, inbound_layers, node_indices, tensor_indices)\r\n  File \"/home/cogniton/research/code/keras/keras/engine/topology.py\", line 141, in create_node\r\n    input_tensors.append(inbound_node.output_tensors[tensor_index])\r\nIndexError: list index out of range\r\n```\r\n.4. hmm. what if i just skip this whole node thing\r\n```\r\n  File \"/home/cogniton/research/code/keras/keras/engine/topology.py\", line 452, in __call__\r\n    '\". This layer has no information'\r\nException: You tried to call layer \"summarize_context\". This layer has no information about its expected input shape, and thus cannot be built. You can build it manually via: `layer.build(batch_input_shape)`\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/217067351","html_url":"https://github.com/fchollet/keras/issues/2617#issuecomment-217067351","issue_url":"https://api.github.com/repos/fchollet/keras/issues/2617","id":217067351,"user":{"login":"braingineer","id":1455742,"avatar_url":"https://avatars.githubusercontent.com/u/1455742?v=3","gravatar_id":"","url":"https://api.github.com/users/braingineer","html_url":"https://github.com/braingineer","followers_url":"https://api.github.com/users/braingineer/followers","following_url":"https://api.github.com/users/braingineer/following{/other_user}","gists_url":"https://api.github.com/users/braingineer/gists{/gist_id}","starred_url":"https://api.github.com/users/braingineer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/braingineer/subscriptions","organizations_url":"https://api.github.com/users/braingineer/orgs","repos_url":"https://api.github.com/users/braingineer/repos","events_url":"https://api.github.com/users/braingineer/events{/privacy}","received_events_url":"https://api.github.com/users/braingineer/received_events","type":"User","site_admin":false},"created_at":"2016-05-05T03:14:58Z","updated_at":"2016-05-05T03:14:58Z","body":"Ha.... that does seem way simpler.  \r\n\r\nI don't think there's anything in particular I'm depending on there.  If the current thing doesn't work out / I need to further muck things up, that'll probably be the route I'll take.  \r\n\r\nThanks!\r\n\r\n\r\n"}}