'See `reshape`.'

def set_shape(self, shape):

    shape = tuple(shape)
    if (len(shape) != 2):
        raise ValueError('Only    two-dimensional    sparse    arrays    are    supported.')
    try:
        shape = (int(shape[0]), int(shape[1]))
    except:
        raise TypeError('invalid    shape')
    if (not ((shape[0] >= 0) and (shape[1] >= 0))):
        raise ValueError('invalid    shape')
    if ((self._shape != shape) and (self._shape is not None)):
        try:
            self = self.reshape(shape)
        except NotImplementedError:
            raise NotImplementedError(('Reshaping    not    implemented    for    %s.' % self.__class__.__name__))
    self._shape = shape
