{"action":"opened","issue":{"url":"https://api.github.com/repos/keras-team/keras/issues/11212","repository_url":"https://api.github.com/repos/keras-team/keras","labels_url":"https://api.github.com/repos/keras-team/keras/issues/11212/labels{/name}","comments_url":"https://api.github.com/repos/keras-team/keras/issues/11212/comments","events_url":"https://api.github.com/repos/keras-team/keras/issues/11212/events","html_url":"https://github.com/keras-team/keras/issues/11212","id":362978973,"node_id":"MDU6SXNzdWUzNjI5Nzg5NzM=","number":11212,"title":"Python 2 and 3 get_layer differences.","user":{"login":"balbok0","id":21700398,"node_id":"MDQ6VXNlcjIxNzAwMzk4","avatar_url":"https://avatars2.githubusercontent.com/u/21700398?v=4","gravatar_id":"","url":"https://api.github.com/users/balbok0","html_url":"https://github.com/balbok0","followers_url":"https://api.github.com/users/balbok0/followers","following_url":"https://api.github.com/users/balbok0/following{/other_user}","gists_url":"https://api.github.com/users/balbok0/gists{/gist_id}","starred_url":"https://api.github.com/users/balbok0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balbok0/subscriptions","organizations_url":"https://api.github.com/users/balbok0/orgs","repos_url":"https://api.github.com/users/balbok0/repos","events_url":"https://api.github.com/users/balbok0/events{/privacy}","received_events_url":"https://api.github.com/users/balbok0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-23T21:27:37Z","updated_at":"2018-09-23T21:27:37Z","closed_at":null,"author_association":"NONE","body":"Hi, \r\nI was trying to call a get_layer on a given index of it, and while it worked like charm in python 3, there was something with with topology.InputLayer layer in python2. I'm running keras on top of tensorflow in both cases, however in case on python3 it's on cpu (with AVX and SSE4.2), and in case of python2 on gpu (I'm not sure with what flags tensorflow was build, since it's on a server).\r\n\r\nCode to reproduce:\r\n```\r\nfrom keras.models import Sequential\r\nfrom keras.layers import Conv2D, MaxPool2D, Dense, Dropout, Activation, Flatten\r\n\r\nm = Sequential()\r\nm.add(Activation('linear', input_shape=[25, 25, 1]))\r\nm.add(Conv2D(16, (3, 3), padding='same'))\r\nm.add(MaxPool2D())\r\nm.add(Flatten())\r\nm.add(Dense(20))\r\nm.add(Dropout(0.5))\r\nm.add(Dense(2))\r\nfor i in range(len(m.layers)):\r\n        print(m.get_layer(index=i))\r\n```\r\n\r\nOutput in python3 (as expected):\r\n```\r\n<keras.layers.core.Activation object at 0x7f8bd37b8c18>\r\n<keras.layers.convolutional.Conv2D object at 0x7f8ba30acd68>\r\n<keras.layers.pooling.MaxPooling2D object at 0x7f8ba30acc50>\r\n<keras.layers.core.Flatten object at 0x7f8ba30acbe0>\r\n<keras.layers.core.Dense object at 0x7f8ba30d3748>\r\n<keras.layers.core.Dropout object at 0x7f8ba3069f60>\r\n<keras.layers.core.Dense object at 0x7f8ba3069e10>\r\n```\r\n\r\nOutput in python2:\r\n```\r\n<keras.engine.topology.InputLayer object at 0x7fbcac623850>\r\n<keras.layers.core.Activation object at 0x7fbcac623810>\r\n<keras.layers.convolutional.Conv2D object at 0x7fbcac6239d0>\r\n<keras.layers.pooling.MaxPooling2D object at 0x7fbcac623950>\r\n<keras.layers.core.Flatten object at 0x7fbcac623a90>\r\n<keras.layers.core.Dense object at 0x7fbcac5c36d0>\r\n<keras.layers.core.Dropout object at 0x7fbcac5f4250>\r\n```"}}
{"actor":{"display_login":"balbok0"}}