# Converting keras model to pytorch

**URL:** <https://discuss.pytorch.org/t/converting-keras-model-to-pytorch/118585>\
**Category:** Uncategorized\
**Created:** [April 18, 2021, 12:39pm UTC](https://discuss.pytorch.org/t/converting-keras-model-to-pytorch/118585 "2021-04-18T12:39:32Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [April 20, 2021, 4:37am UTC](https://discuss.pytorch.org/t/converting-keras-model-to-pytorch/118585/4 "2021-04-20T04:37:55Z")

</div>

I don’t know how `Model` is defined but assuming that `self.layer_name` gets an intermediate activation from `ResNet50`, you could either use forward hooks as described [here](https://discuss.pytorch.org/t/how-can-l-load-my-best-model-as-a-feature-extractor-evaluator/17254/6) or override the `forward` of the resnet implementation so that the desired activation will be returned.

---

_[View the full topic](https://discuss.pytorch.org/t/converting-keras-model-to-pytorch/118585)._
