'Adds a bottleneck residual block as per Arxiv 1512.03385, Figure 3'

def add_bottleneck_residual_block(self, num_units, mapsize=3, stride=1, transpose=False):

    assert ((len(self.get_output().get_shape()) == 4) and 'Previous    layer    must    be    4-dimensional    (batch,    width,    height,    channels)')
    if ((num_units != int(self.get_output().get_shape()[3])) or (stride != 1)):
        ms = (1 if (stride == 1) else mapsize)
        if transpose:
            self.add_conv2d_transpose(num_units, mapsize=ms, stride=stride, stddev_factor=1.0)
        else:
            self.add_conv2d(num_units, mapsize=ms, stride=stride, stddev_factor=1.0)
    bypass = self.get_output()
    self.add_batch_norm()
    self.add_relu()
    self.add_conv2d((num_units // 4), mapsize=1, stride=1, stddev_factor=2.0)
    self.add_batch_norm()
    self.add_relu()
    if transpose:
        self.add_conv2d_transpose((num_units // 4), mapsize=mapsize, stride=1, stddev_factor=2.0)
    else:
        self.add_conv2d((num_units // 4), mapsize=mapsize, stride=1, stddev_factor=2.0)
    self.add_batch_norm()
    self.add_relu()
    self.add_conv2d(num_units, mapsize=1, stride=1, stddev_factor=2.0)
    self.add_sum(bypass)
    return self
