def equal_axis(*args, **axis):
    """Check that elements have the same dimension on specified axis.
    """
    axis = axis.get("axis", -1)
    for i, arg in enumerate(args):
        if not isinstance(arg, ndarray):
            raise ExpectedTypeError(arg, ["ndarray"])
        if axis >= 0 and (axis + 1) < arg.shape[axis]:
            raise ShapeMismatchError(arg.shape[axis], axis, [])
        if i >= 1 and arg.shape[axis] != args[0].shape[axis]:
            lengths = [a.shape[axis] for a in args]
            raise DifferentLengthError(lengths, arg)
def equal_axis ( * args , ** axis ) : axis = axis . get ( "axis" , - 1 ) for i , arg in enumerate ( args ) : if not isinstance ( arg , ndarray ) : raise ExpectedTypeError ( arg , [ "ndarray" ] ) if axis >= 0 and ( axis + 1 ) < arg . shape [ axis ] : raise ShapeMismatchError ( arg . shape [ axis ] , axis , [ ] ) if i >= 1 and arg . shape [ axis ] != args [ 0 ] . shape [ axis ] : lengths = [ a . shape [ axis ] for a in args ] raise DifferentLengthError ( lengths , arg )
Check that elements have the same dimension on specified axis.