import tensorflow as tf

            out = tf.reshape(out, [self.out_modes[i], -1])
            out = tf.transpose(out, [1, 0])

        out = tf.reshape(out, [-1, np.prod(self.out_modes)])
        # self.image_max_size = max(self.image_max_size, np.prod([val.value for val in out.get_shape()[1:]]))
        if self.use_bias:
            out = tf.add(out, self.bias, name='out')

        if self.activation is not None:
            out = self.activation(out)
        return out

