How does one compute the norm of a function in pytorch?

My current way is to convert everything to numpy and do:

def functional_diff_norm(f1, f2, lb, ub, p=2):
    """
    Computes norm:

    ||f||_p = (int_S |f|^p dmu)^1/p

    https://en.wikipedia.org/wiki/Lp_space

    https://stackoverflow.com/questions/63237199/how-does-one-compute-the-norm-of-a-function-in-python
    """
    norm = integrate.quad(lambda x: (f1(x) - f2(x))**p, lb, ub)
    return norm

is this a good way to do it?

reference: https://stackoverflow.com/questions/63237199/how-does-one-compute-the-norm-of-a-function-in-python