{
  "id": 185261,
  "title": "TensorFlow issue",
  "url": "/competitions/tpu-getting-started/discussion/185261",
  "author_name": "Mohammed Rizin V K",
  "post_date": "2020-09-20T05:44:13.005000",
  "votes": 0,
  "comment_count": 1,
  "views": null,
  "content": "<p>How to get output of some convolution layers in TensorFlow</p>",
  "messages": [
    {
      "id": 1030895,
      "postDate": "2020-09-29T04:51:02.100Z",
      "content": "<p>There are some answers on stack overflow e.g.</p>\n<p><a href=\"https://stackoverflow.com/questions/43452353/obtaining-output-of-an-intermediate-layer-in-tensorflow-keras\" target=\"_blank\">https://stackoverflow.com/questions/43452353/obtaining-output-of-an-intermediate-layer-in-tensorflow-keras</a><br>\n<a href=\"https://stackoverflow.com/questions/59504884/how-tensorflow2-gets-intermediate-layer-output\" target=\"_blank\">https://stackoverflow.com/questions/59504884/how-tensorflow2-gets-intermediate-layer-output</a></p>\n<p>I used one of them a while back - I don't know if this is the best answer or whether it will work for you so best to check stackoverflow options but anyway the below did work for me</p>\n<p>You can get the layer name by using model_name.summary(), once you have created the overall model</p>\n<p>layer_name = 'replace with the name of the layer' <br>\nintermediate_layer_model = Model(inputs=model_name.input,<br>\n                                 outputs=model_name.get_layer(layer_name).output)</p>\n<p>then you can call intermediate_layer_model.predict(data) and that should give you the intermediate layer output.</p>",
      "rawMarkdown": "There are some answers on stack overflow e.g.\n\nhttps://stackoverflow.com/questions/43452353/obtaining-output-of-an-intermediate-layer-in-tensorflow-keras\nhttps://stackoverflow.com/questions/59504884/how-tensorflow2-gets-intermediate-layer-output\n\nI used one of them a while back - I don't know if this is the best answer or whether it will work for you so best to check stackoverflow options but anyway the below did work for me\n\nYou can get the layer name by using model_name.summary(), once you have created the overall model\n\nlayer_name = 'replace with the name of the layer' \nintermediate_layer_model = Model(inputs=model_name.input,\n                                 outputs=model_name.get_layer(layer_name).output)\n\nthen you can call intermediate_layer_model.predict(data) and that should give you the intermediate layer output.",
      "votes": 1
    },
    {
      "id": 1018982,
      "postDate": "2020-09-20T05:44:13.007Z",
      "content": "<p>How to get output of some convolution layers in TensorFlow</p>",
      "rawMarkdown": "How to get output of some convolution layers in TensorFlow"
    }
  ],
  "comments": [
    {
      "id": 1030895,
      "author_name": "Dave E",
      "author_url": "",
      "post_date": "2020-09-29T04:51:02.100000",
      "content": "<p>There are some answers on stack overflow e.g.</p>\n<p><a href=\"https://stackoverflow.com/questions/43452353/obtaining-output-of-an-intermediate-layer-in-tensorflow-keras\" target=\"_blank\">https://stackoverflow.com/questions/43452353/obtaining-output-of-an-intermediate-layer-in-tensorflow-keras</a><br>\n<a href=\"https://stackoverflow.com/questions/59504884/how-tensorflow2-gets-intermediate-layer-output\" target=\"_blank\">https://stackoverflow.com/questions/59504884/how-tensorflow2-gets-intermediate-layer-output</a></p>\n<p>I used one of them a while back - I don't know if this is the best answer or whether it will work for you so best to check stackoverflow options but anyway the below did work for me</p>\n<p>You can get the layer name by using model_name.summary(), once you have created the overall model</p>\n<p>layer_name = 'replace with the name of the layer' <br>\nintermediate_layer_model = Model(inputs=model_name.input,<br>\n                                 outputs=model_name.get_layer(layer_name).output)</p>\n<p>then you can call intermediate_layer_model.predict(data) and that should give you the intermediate layer output.</p>",
      "votes": 1,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1030895": "There are some answers on stack overflow e.g.\n\nhttps://stackoverflow.com/questions/43452353/obtaining-output-of-an-intermediate-layer-in-tensorflow-keras\nhttps://stackoverflow.com/questions/59504884/how-tensorflow2-gets-intermediate-layer-output\n\nI used one of them a while back - I don't know if this is the best answer or whether it will work for you so best to check stackoverflow options but anyway the below did work for me\n\nYou can get the layer name by using model_name.summary(), once you have created the overall model\n\nlayer_name = 'replace with the name of the layer' \nintermediate_layer_model = Model(inputs=model_name.input,\n                                 outputs=model_name.get_layer(layer_name).output)\n\nthen you can call intermediate_layer_model.predict(data) and that should give you the intermediate layer output.",
    "1018982": "How to get output of some convolution layers in TensorFlow"
  }
}