MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / resnet_shortcut

Function resnet_shortcut

examples/FasterRCNN/modeling/backbone.py:124–134  ·  view source on GitHub ↗
(l, n_out, stride, activation=tf.identity)

Source from the content-addressed store, hash-verified

122
123
124def resnet_shortcut(l, n_out, stride, activation=tf.identity):
125 n_in = l.shape[1]
126 if n_in != n_out: # change dimension when channel is not the same
127 # TF's SAME mode output ceil(x/stride), which is NOT what we want when x is odd and stride is 2
128 # In FPN mode, the images are pre-padded already.
129 if not cfg.MODE_FPN and stride == 2:
130 l = l[:, :, :-1, :-1]
131 return Conv2D('convshortcut', l, n_out, 1,
132 strides=stride, activation=activation)
133 else:
134 return l
135
136
137def resnet_bottleneck(l, ch_out, stride):

Callers 1

resnet_bottleneckFunction · 0.70

Calls 1

Conv2DFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…