@functools.wraps(DenseDesignMatrix.get_topological_view)
    def get_topological_view(self, mat=None, single_tensor=False):
        """
        Return a topological view.

        Parameters
        ----------
        mat : ndarray
          A design matrix of images, one per row.

        single_tensor : bool
          If True, returns a single tensor. If False, returns separate
          tensors for the left and right stereo images.

        returns : ndarray, tuple
          If single_tensor is True, returns ndarray.
          Else, returns the tuple (left_images, right_images).
        """

        # Get topo view from view converter.
        result = super(NORB, self).get_topological_view(mat)

        # If single_tensor is True, merge the left and right image tensors
        # into a single stereo tensor.
        if single_tensor:
            # Check that the view_converter has a stereo axis, and that it
            # returned a tuple (left_images, right_images)
            if self.view_converter.axes not in 's':
                raise ValueError('self.view_converter.axes must contain "s" '
                                 '(stereo image index) in order to split the '
                                 'images into left and right images. Instead, '
                                 'the axes were %s.'
                                 % str(self.view_converter.axes))
            assert isinstance(result, tuple)
            assert len(result) == 2

            axes = list(self.view_converter.axes)
            s_index = axes.index('s')
            assert axes.index('b') == 0
            num_image_pairs = result[0].shape[0]
            shape = (num_image_pairs, ) + self.view_converter.shape

            # inserts a singleton dimension where the 's' dimesion will be
            mono_shape = shape[:s_index] + (1, ) + shape[(s_index + 1):]

            result = tuple(t.reshape(mono_shape) for t in result)
            result = numpy.concatenate(result, axis=s_index)

        return result
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/datasets/new_norb.py/NORB.get_topological_view/swapped operands of `not in`