0

I have a function that looks like this:

def f(x, y):
    def g(w):
        def h(z):
            return z * (w ** 2) * (x + y)
        return h
    return g

I want to calculate the partial derivatives of f w.r.t (x, y, w, z) at point say (x0, y0, w0, z0) using autograd.
The code is of course in python.
Thanks.

  • `f` doesn't have the partial derivatives you're asking for. It's a function of two arguments that returns another function, not a function of four arguments that returns a number. – user2357112 Nov 04 '21 at 21:31
  • If you want to find the partial derivatives of the related function `def f2(x, y, w, z): return f(x, y)(w)(z)`, you should be able to handle f2 just like any other function. – user2357112 Nov 04 '21 at 21:33

0 Answers0