liveBook · Manning

Hierarchy

As explained in Deep Learning with R, Third Edition

A JAX tree is a nested structure of named or unnamed lists and array values used as structured function state.

A hierarchy arranges components in nested levels. In JAX, a tree is a nested structure of named or unnamed lists that can hold function state, letting a loss function receive several variables together. section 9.1 section 3.5.3

compute_loss <- function(state, x, y) {  #1
  .....
  loss
}

grad_fn <- jax$value_and_grad(compute_loss)
state <- list(a, b, c)
.[loss, grads_of_loss_wrt_state] <- grad_fn(state, x, y)  #2

See state grouped as a list and passed as the first argument to a loss function before computing gradients. section 3.5.3

How Deep Learning with R, Third Edition covers it

How deep it goes
Defines trees and shows them passed to value_and_grad, without detailing tree operations.
Examples
Uses state = list(a, b, c) as a loss-function argument alongside x and y inputs.
What you can do after
Apply trees via JAX's value_and_grad to group state variables and compute gradients.
How it connects
Connects trees to loss functions, gradients, and JAX's value_and_grad utility.

Also explained in

Compare how 7 books explain hierarchy →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.