in utils/gluon/utils/octconv.py [0:0]
def __init__(self, channels, in_channels=0, prefix=None, **kwargs):
super(SE, self).__init__(prefix=prefix, **kwargs)
# be compatible to conventional convolution
in_c_h, in_c_l = in_channels if type(in_channels) is tuple else (in_channels, -1)
assert in_c_l != 0 and in_c_h != 0, \
"TODO: current version has to specify the `in_channels' to determine the computation graph, but got {}".format(in_channels)
has_h = in_c_h > 0
has_l = in_c_l > 0
with self.name_scope():
self.conv1 = nn.Conv2D(channels, kernel_size=1, padding=0, prefix='-conv1_')
self.relu1 = nn.Activation('relu')
self.conv2_h = nn.Conv2D(in_c_h, kernel_size=1, padding=0,
prefix='-conv2-h_') if has_h else lambda x: None
self.sigmoid2_h = nn.Activation('sigmoid') if has_h else lambda x: None
self.conv2_l = nn.Conv2D(in_c_l, kernel_size=1, padding=0,
prefix='-conv2-l_') if has_l else lambda x: None
self.sigmoid2_l = nn.Activation('sigmoid') if has_l else lambda x: None