{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/3903","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/3903/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/3903/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/3903/events","html_url":"https://github.com/fchollet/keras/issues/3903","id":179907314,"number":3903,"title":"keras 1.0.4 sharing batchnormalization layer across different data flows.","user":{"login":"isaacgerg","id":11971499,"avatar_url":"https://avatars.githubusercontent.com/u/11971499?v=3","gravatar_id":"","url":"https://api.github.com/users/isaacgerg","html_url":"https://github.com/isaacgerg","followers_url":"https://api.github.com/users/isaacgerg/followers","following_url":"https://api.github.com/users/isaacgerg/following{/other_user}","gists_url":"https://api.github.com/users/isaacgerg/gists{/gist_id}","starred_url":"https://api.github.com/users/isaacgerg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isaacgerg/subscriptions","organizations_url":"https://api.github.com/users/isaacgerg/orgs","repos_url":"https://api.github.com/users/isaacgerg/repos","events_url":"https://api.github.com/users/isaacgerg/events{/privacy}","received_events_url":"https://api.github.com/users/isaacgerg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-28T22:26:42Z","updated_at":"2016-09-29T13:20:08Z","closed_at":null,"body":"        input_tensor = keras.layers.Input(shape=(3, 200, 200))\r\n        resnetModel = keras.applications.resnet50.ResNet50(include_top=False, weights='imagenet', input_tensor=input_tensor)\r\n        \r\n        for k in resnetModel.layers:\r\n            print(k)\r\n            \r\n        #split = 162\r\n        \r\n        #for k in resnetModel.layers[:split]:\r\n        #    k.trainable = False\r\n        \r\n        model = Sequential()                \r\n        model.add(AveragePooling2D(pool_size=(2,2), input_shape=(1, 400, 400))) # Downsample input data\r\n        model.add(Flatten())\r\n        model.add(keras.layers.RepeatVector(3))\r\n        model.add(Reshape((3, 200, 200)))                          \r\n        model.add(resnetModel)\r\n\r\nThis code gives me the following and am unsure why.  Any ideas?\r\nbuiltins.Exception: You are attempting to share a same `BatchNormalization` layer across different data flows. This is not possible. You should use `mode=2` in `BatchNormalization`, which has a similar behavior but is shareable (see docs for a description of the behavior)."},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/250463592","html_url":"https://github.com/fchollet/keras/issues/3903#issuecomment-250463592","issue_url":"https://api.github.com/repos/fchollet/keras/issues/3903","id":250463592,"user":{"login":"isaacgerg","id":11971499,"avatar_url":"https://avatars.githubusercontent.com/u/11971499?v=3","gravatar_id":"","url":"https://api.github.com/users/isaacgerg","html_url":"https://github.com/isaacgerg","followers_url":"https://api.github.com/users/isaacgerg/followers","following_url":"https://api.github.com/users/isaacgerg/following{/other_user}","gists_url":"https://api.github.com/users/isaacgerg/gists{/gist_id}","starred_url":"https://api.github.com/users/isaacgerg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isaacgerg/subscriptions","organizations_url":"https://api.github.com/users/isaacgerg/orgs","repos_url":"https://api.github.com/users/isaacgerg/repos","events_url":"https://api.github.com/users/isaacgerg/events{/privacy}","received_events_url":"https://api.github.com/users/isaacgerg/received_events","type":"User","site_admin":false},"created_at":"2016-09-29T13:20:07Z","updated_at":"2016-09-29T13:20:07Z","body":"I tried the same thing and also got the graph disconnected issue.\n\nOn Thu, Sep 29, 2016 at 4:33 AM, dolaameng <notifications@github.com> wrote:\n\n> I guess the way for ResNet to be piped with other models (without creating\n> another data flow) is to pass the output of a model to its input_tensor\n> parameter. Something like this\n>\n> x = Input(shape=(1, 400, 400))\n> y = AveragePooling2D(pool_size=(2, 2))(x)\n> y = Flatten()(y)\n> y = RepeatVector(3)(y)\n> y = Reshape((3, 200, 200), )(y)\n>\n> resnet = resnet50.ResNet50(include_top=False, weights='imagenet',\n>                            input_tensor=y)\n>\n> model = Model(input=x, output=resnet.output)\n>\n> But it got an Graph disconnected error because y is a Keras tensor\n> (K.is_keras_tensor(y)=True) and is from an non-input layer. I also want to\n> know how to do this.\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/fchollet/keras/issues/3903#issuecomment-250404386>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/ALarqxxChkA7mFZFJ7rT5ZK-g9kM-Zahks5qu3fqgaJpZM4KJYkG>\n> .\n>\n"}}
{"actor":{"display_login":"isaacgerg"}}