    def check_rank(inputs: List[Tensor], dim) -> bool:
        """check if the rank is valid"""
        if len(inputs) < 1:
            raise RuntimeError("expected a list of Tensors")
        rank = concatenate.get_rank(inputs)
        if rank is None:
            return
        if rank <= 0:
            raise RuntimeError("expected a non-scalar tensor")
        if dim >= rank:
            raise RuntimeError(
                f"concat_dim ({dim}) expected to be less than rank ({rank})"
            )
        for t in inputs:
            if shape_utils.is_empty_rank1_tensor(t._attrs["shape"]):
                continue
            r = len(t._attrs["shape"])
            if r != rank:
                raise RuntimeError(
                    f"tensors expected to have the same rank but got {rank=} "
                    f'and {r=} for tensor {t._attrs["name"]}'
                )
check if the rank is valid
python/aitemplate/compiler/ops/tensor/concatenate.py