def listify(p=None, q=None):
    # https://github.com/fastai/fastai1/blob/master/fastai/core.py#L129
    "Make `p` listy and the same length as `q`."
    if p is None:
        p = []
    elif isinstance(p, str):
        p = [p]
    elif not isinstance(p, list):
        p = [p]
    # Rank 0 tensors in PyTorch are Iterable but don't have a length.
    else:
        try:
            a = len(p)
        except:
            p = [p]
    n = q if type(q) == int else len(p) if q is None else len(q)
    if len(p) == 1:
        p = p * n
    assert len(p) == n, f"List len mismatch ({len(p)} vs {n})"
    return list(p)
Make `p` listy and the same length as `q`.
analyze/convnexts4nd/src/models/baselines/nonaka/basic_conv1d.py