Skip to Content
DocumentationAutogradfunctional

functional

View the code on GitHub

Structs

Functions

backward

backward(arg: Array, create_graph: Bool)
Performs backward propagation on the given Array.
Args
  • arg: Array

  • create_graph: Bool

jacrev

jacrev(arg: Array, create_graph: Bool)
Computes the reverse-mode Jacobian for the given Array.
Args
  • arg: Array

  • create_graph: Bool

grad

grad(outs: List[Array], inputs: List[Array], retain_grads: Bool = True, create_graph: Bool = False) -> List[Array]
Computes gradients of outputs with respect to inputs.
Args
  • outs: List[Array]

  • inputs: List[Array]

  • retain_grads: Bool (default: True)

  • create_graph: Bool (default: False)

Returns
  • List[Array]
grad(f: Callable, argnums: List[Int] = List(-1)) -> Callable
Computes the gradient of a Callable function with respect to specified arguments.
Args
  • f: Callable

  • argnums: List[Int] (default: List(-1))

Returns
  • Callable
grad(f: fn(List[Array]) raises -> Array, argnums: List[Int] = List(-1)) -> Callable
Computes the gradient of a function that takes a list of Arrays and returns an Array.
Args
  • f: fn(List[Array]) raises -> Array

  • argnums: List[Int] (default: List(-1))

Returns
  • Callable
grad(f: fn(Array) raises -> Array, argnums: List[Int] = List(-1)) -> Callable
Computes the gradient of a function that takes a single Array and returns an Array.
Args
  • f: fn(Array) raises -> Array

  • argnums: List[Int] (default: List(-1))

Returns
  • Callable

jacobian

jacobian(f: Callable, argnums: List[Int] = List(-1)) -> Callable
Computes the Jacobian of a Callable function with respect to specified arguments.
Args
  • f: Callable

  • argnums: List[Int] (default: List(-1))

Returns
  • Callable
jacobian(f: fn(List[Array]) raises -> Array, argnums: List[Int] = List(-1)) -> Callable
Computes the Jacobian of a function that takes a list of Arrays and returns an Array.
Args
  • f: fn(List[Array]) raises -> Array

  • argnums: List[Int] (default: List(-1))

Returns
  • Callable
jacobian(f: fn(Array) raises -> Array, argnums: List[Int] = List(-1)) -> Callable
Computes the Jacobian of a function that takes a single Array and returns an Array.
Args
  • f: fn(Array) raises -> Array

  • argnums: List[Int] (default: List(-1))

Returns
  • Callable
jacobian(f: Callable, args: List[Array]) -> List[Array]
Computes the Jacobian of a Callable function with respect to given arguments.
Args
  • f: Callable

  • args: List[Array]

Returns
  • List[Array]
jacobian(f: fn(List[Array]) raises -> Array, args: List[Array]) -> List[Array]
Computes the Jacobian of a function that takes a list of Arrays with respect to given arguments.
Args
  • f: fn(List[Array]) raises -> Array

  • args: List[Array]

Returns
  • List[Array]
jacobian(f: fn(Array) raises -> Array, arg: Array) -> Array
Computes the Jacobian of a function that takes a single Array with respect to the given argument.
Args
  • f: fn(Array) raises -> Array

  • arg: Array

Returns
  • Array

hessian

hessian(f: Callable, argnums: List[Int] = List(-1)) -> Callable
Computes the Hessian of a Callable function with respect to specified arguments.
Args
  • f: Callable

  • argnums: List[Int] (default: List(-1))

Returns
  • Callable
hessian(f: fn(List[Array]) raises -> Array, argnums: List[Int] = List(-1)) -> Callable
Computes the Hessian of a function that takes a list of Arrays and returns an Array.
Args
  • f: fn(List[Array]) raises -> Array

  • argnums: List[Int] (default: List(-1))

Returns
  • Callable
hessian(f: fn(Array) raises -> Array, argnums: List[Int] = List(-1)) -> Callable
Computes the Hessian of a function that takes a single Array and returns an Array.
Args
  • f: fn(Array) raises -> Array

  • argnums: List[Int] (default: List(-1))

Returns
  • Callable
hessian(f: Callable, args: List[Array]) -> List[Array]
Computes the Hessian of a Callable function with respect to given arguments.
Args
  • f: Callable

  • args: List[Array]

Returns
  • List[Array]
hessian(f: fn(List[Array]) raises -> Array, args: List[Array]) -> List[Array]
Computes the Hessian of a function that takes a list of Arrays with respect to given arguments.
Args
  • f: fn(List[Array]) raises -> Array

  • args: List[Array]

Returns
  • List[Array]
hessian(f: fn(Array) raises -> Array, arg: Array) -> Array
Computes the Hessian of a function that takes a single Array with respect to the given argument.
Args
  • f: fn(Array) raises -> Array

  • arg: Array

Returns
  • Array

value_and_grad

value_and_grad(arg: Variant[Callable, fn(List[Array]) raises -> Array], argnums: List[Int] = List(-1)) -> Callable
Computes both the value and gradient of a function or Callable with respect to specified arguments.
Args
  • arg: Variant[Callable, fn(List[Array]) raises -> Array]

  • argnums: List[Int] (default: List(-1))

Returns
  • Callable
Last updated on