I have the following demo model:
class MyModel(Model):
def __init__(self):
super(MyModel, self).__init__()
self.conv1 = Conv2D(32, 3, activation='relu')
self.flatten = Flatten()
self.d1 = Dense(128, activation='relu')
self.d2 = Dense(10)
def call(self, x):
x1 = self.conv1(x)
x2 = self.flatten(x1)
x3 = self.d1(x2)
return self.d2(x3)
# Create an instance of the model
model = MyModel()
During training, I want to get the output of the intermediate layer, for example self.conv1
, x2
.
Do you have any suggestions?
thx