'Returns a list with dimensions of each index.
Dimensions is a property of the array, not of the indices.  Still, if
the ``IndexedBase`` does not define a shape attribute, it is assumed
that the ranges of the indices correspond to the shape of the array.
>>> from sympy import IndexedBase, Idx, symbols
>>> n, m = symbols(\'n m\', integer=True)
>>> i = Idx(\'i\', m)
>>> j = Idx(\'j\', m)
>>> A = IndexedBase(\'A\', shape=(n, n))
>>> B = IndexedBase(\'B\')
>>> A[i, j].shape
(n, n)
>>> B[i, j].shape
(m, m)'

@property
def shape(self):

    from sympy.utilities.misc import filldedent
    if self.base.shape:
        return self.base.shape
    try:
        return Tuple(*[((i.upper - i.lower) + 1) for i in self.indices])
    except AttributeError:
        raise IndexException(filldedent(('\n                                                                Range    is    not    defined    for    all    indices    in:    %s' % self)))
    except TypeError:
        raise IndexException(filldedent(('\n                                                                Shape    cannot    be    inferred    from    Idx    with\n                                                                undefined    range:    %s' % self)))
