MCPcopy Create free account
hub / github.com/pytorch/pytorch / add_basic_unit

Method add_basic_unit

caffe2/python/models/shufflenet.py:115–138  ·  view source on GitHub ↗
(self, prefix, in_channels, stride=1)

Source from the content-addressed store, hash-verified

113
114 # basic unit with stride=1
115 def add_basic_unit(self, prefix, in_channels, stride=1):
116 in_channels = in_channels // 2
117 left = prefix + '_left'
118 right = prefix + '_right'
119 self.model.net.Split(self.prev_blob, [left, right])
120
121 if self.detection:
122 right = self.add_detection_unit(right, prefix + '_right_detection',
123 in_channels, in_channels)
124
125 right = self.add_conv1x1_bn(right, prefix + '_right_conv1',
126 in_channels, in_channels)
127 right = self.add_dwconv3x3_bn(right, prefix + '_right_dwconv',
128 in_channels, stride)
129 right = self.add_conv1x1_bn(right, prefix + '_right_conv2',
130 in_channels, in_channels)
131
132 self.prev_blob = brew.concat(self.model, [right, left],
133 prefix + '_concat')
134
135 self.prev_blob = self.model.net.ChannelShuffle(
136 self.prev_blob, prefix + '_ch_shuffle',
137 group=self.num_groups, kernel=1
138 )
139
140 # helper functions to create net's units
141 def add_detection_unit(self, prev_blob, prefix, in_channels, out_channels,

Callers 1

createMethod · 0.95

Calls 4

add_detection_unitMethod · 0.95
add_conv1x1_bnMethod · 0.95
add_dwconv3x3_bnMethod · 0.95
concatMethod · 0.80

Tested by

no test coverage detected