| 31 | |
| 32 | |
| 33 | class basic_dynamic_model(Model): |
| 34 | |
| 35 | def __init__(self, include_top=True): |
| 36 | super(basic_dynamic_model, self).__init__() |
| 37 | self.include_top = include_top |
| 38 | self.conv1 = Conv2d(16, (5, 5), (1, 1), padding='SAME', act=tf.nn.relu, in_channels=3, name="conv1") |
| 39 | self.pool1 = MaxPool2d((3, 3), (2, 2), padding='SAME', name='pool1') |
| 40 | |
| 41 | self.conv2 = Conv2d(16, (5, 5), (1, 1), padding='SAME', act=tf.nn.relu, in_channels=16, name="conv2") |
| 42 | self.pool2 = MaxPool2d((3, 3), (2, 2), padding='SAME', name='pool2') |
| 43 | |
| 44 | self.flatten = Flatten(name='flatten') |
| 45 | self.dense1 = Dense(100, act=None, in_channels=576, name="dense1") |
| 46 | if include_top is True: |
| 47 | self.dense2 = Dense(10, act=None, in_channels=100, name="dense2") |
| 48 | |
| 49 | def forward(self, x): |
| 50 | x = self.conv1(x) |
| 51 | x = self.pool1(x) |
| 52 | x = self.conv2(x) |
| 53 | x = self.pool2(x) |
| 54 | x = self.flatten(x) |
| 55 | x = self.dense1(x) |
| 56 | if self.include_top: |
| 57 | x = self.dense2(x) |
| 58 | return x |
| 59 | |
| 60 | |
| 61 | class Nested_VGG(Model): |
no outgoing calls
searching dependent graphs…