I want to seperate the encoder and the decoder after training the model. Can any one help me as am new to deep learning

pbud: <p>This is my code</p>
<p><span class="hashtag">#the</span> model<br>
nstrides = (1,1)</p>
<p>from keras.layers.convolutional import Conv2D, MaxPooling2D<br>
from keras.models import Sequential<br>
from keras.layers import Dense, Activation</p>
<p><span class="hashtag">#first</span> we define the inputs, which is the shape of images defined in the code blocks above<br>
inputs = layers.Input(imshape)</p>
<p><span class="hashtag">#block1</span><br>
conv01 = layers.Conv2D(32, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(inputs)<br>
conv1 = layers.Conv2D(32, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conv01)<br>
pool1 = layers.MaxPooling2D(pool_size=(2, 2))(conv1)</p>
<p><span class="hashtag">#block2</span><br>
conv02 = layers.Conv2D(64, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(pool1)<br>
conv2 = layers.Conv2D(64, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conv02)<br>
pool2 = layers.MaxPooling2D(pool_size=(2, 2))(conv2)</p>
<p><span class="hashtag">#block3</span><br>
conv03 = layers.Conv2D(128, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(pool2)<br>
conv3 = layers.Conv2D(128, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conv03)<br>
pool3 = layers.MaxPooling2D(pool_size=(2, 2))(conv3)</p>
<p><span class="hashtag">#block4</span><br>
conv04 = layers.Conv2D(256, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(pool3)<br>
conv4 = layers.Conv2D(256, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conv04)<br>
pool4 = layers.MaxPooling2D(pool_size=(2, 2))(conv4)</p>
<p><span class="hashtag">#bottlneck</span><br>
conv05 = layers.Conv2D(512, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(pool4)<br>
conv5 = layers.Conv2D(512, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conv05)<br>
upconv5 = layers.Conv2DTranspose(256, kernel_size=(2, 2), strides = (2,2))(conv5)</p>
<p><span class="hashtag">#upblock</span> 1<br>
conc6 = layers.concatenate([upconv5, conv4])<br>
conv06 = layers.Conv2D(256, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conc6)<br>
conv6 = layers.Conv2D(256, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conv06)<br>
up7 = layers.Conv2DTranspose(126, kernel_size=(2, 2), strides = (2,2))(conv6)</p>
<p><span class="hashtag">#upblock</span> 2<br>
conc7 = layers.concatenate([up7, conv3])<br>
conv07 = layers.Conv2D(128, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conc7)<br>
conv7 = layers.Conv2D(128, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conv07)<br>
up8 = layers.Conv2DTranspose(64, kernel_size=(2, 2), strides = (2,2))(conv7)</p>
<p><span class="hashtag">#upblock</span> 3<br>
conc8 = layers.concatenate([up8, conv2])<br>
conv08 = layers.Conv2D(64, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conc8)<br>
conv8 = layers.Conv2D(64, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conv08)<br>
up9 = layers.Conv2DTranspose(32, kernel_size=(2, 2), strides = (2,2))(conv8)</p>
<p><span class="hashtag">#upblock</span> 4<br>
conc9 = layers.concatenate([up9, conv1])<br>
conv09 = layers.Conv2D(32, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conc9)<br>
conv9 = layers.Conv2D(32, 4, activation = ‘relu’, strides = nstrides, padding=“same”)(conv09)</p>
<p><span class="hashtag">#we</span> define the outputs here<br>
outputs = layers.Conv2D(1, (1, 1), padding=“same”, activation=“sigmoid”)(conv9)</p>
<p><span class="hashtag">#combine</span> the model together<br>
model = Model(inputs, outputs)</p>
<p><span class="hashtag">#and</span> print out the text summary of the model<br>
model.summary()</p>

Dazitu616: <p>The code you posted is using keras, while this is PyTorch forum. Nonetheless, I think you can refer to <a href="https://keras.io/getting_started/intro_to_keras_for_researchers/#endtoend-experiment-example-1-variational-autoencoders" rel="noopener nofollow ugc">this tutorial</a>, where they construct a VAE model with separated Encoder and Decoder.</p>