(l, out_channel, stride)
| 76 | |
| 77 | @layer_register() |
| 78 | def shufflenet_unit_v2(l, out_channel, stride): |
| 79 | if stride == 1: |
| 80 | shortcut, l = tf.split(l, 2, axis=1) |
| 81 | else: |
| 82 | shortcut, l = l, l |
| 83 | shortcut_channel = int(shortcut.shape[1]) |
| 84 | |
| 85 | l = Conv2D('conv1', l, out_channel // 2, 1, activation=BNReLU) |
| 86 | l = DepthConv('dconv', l, out_channel // 2, 3, stride=stride) |
| 87 | l = BatchNorm('dconv_bn', l) |
| 88 | l = Conv2D('conv2', l, out_channel - shortcut_channel, 1, activation=BNReLU) |
| 89 | |
| 90 | if stride == 2: |
| 91 | shortcut = DepthConv('shortcut_dconv', shortcut, shortcut_channel, 3, stride=2) |
| 92 | shortcut = BatchNorm('shortcut_dconv_bn', shortcut) |
| 93 | shortcut = Conv2D('shortcut_conv', shortcut, shortcut_channel, 1, activation=BNReLU) |
| 94 | output = tf.concat([shortcut, l], axis=1) |
| 95 | output = channel_shuffle(output, 2) |
| 96 | return output |
| 97 | |
| 98 | |
| 99 | @layer_register(log_shape=True) |
no test coverage detected