About fine-tune
Hi @panhu 

Can you provide more details regarding the issue?

You can replace layers in the middle of the model by layer assignment. 

Please refer to the transfer learning and fine tuning [tutorial](https://www.tensorflow.org/guide/keras/transfer_learning#fine-tuning). Also, please refer to the colab [gist](https://colab.research.google.com/gist/pjpratik/251fa430aa21f7e641e1e2baadfe749a/transfer_learning.ipynb) for the same.

Thanks. This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. hello @panhu 
steps to remove the middle layer in the transfer learning model.You can remove it using running a for loop and using pop function to remove up to whichever layer you want and then add any other middle layer. then you can freeze the weights of all layers except the middle layer. after that, you can easily compile and fit your model 

you can refer to the following GitHub gist given below
[githubgist](https://colab.research.google.com/gist/Chinmayadas2003/6875e84ee2c7558fcc9d2e0c1cdaac7a/removing-middle-layers-in-a-pretrained-model.ipynb#scrollTo=kKWSJJ-_wbZQ) This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/59908">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/59908">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Others

### Have you reproduced the bug with TF nightly?

Yes

### Source

source

### Tensorflow Version

tf 2.9

### Custom Code

Yes

### OS Platform and Distribution

_No response_

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

```shell
Hi:
How to replace several layers in the middle of the model during fine-tune？
Thanks
```


### Standalone code to reproduce the issue

```shell
How to replace several layers in the middle of the model during fine-tune？
```


### Relevant log output

_No response_</details>