import torch


def is_non_decreasing(x):
    """Check if values in x are non-decreasing

    :param x: 1D or 2D torch tensor, if 2D checked column-wise
    :return:
    """
    dx = x[1:] - x[:-1]
    return torch.all(dx >= 0, dim=0)