def padding(array, yy, val):
    """
    :param array: torch tensor array
    :param yy: desired width
    :param val: padded value
    :return: padded array
    """
    w = array.shape[0]
    b = 0
    bb = yy - b - w

    return torch.nn.functional.pad(
        array, pad=(b, bb), mode="constant", value=val
    )

    :param array: torch tensor array
    :param yy: desired width
    :param val: padded value
    :return: padded array
    
examples/pytorch/pinsage/sampler.py