Machine Learning in Elixir: inspect_expr/1 is deprecated (page 70)

Examples in GradFun module will show the following warning with Nx 0.5.3

warning: Nx.Defn.Kernel.inspect_expr/1 is deprecated. Use print_expr/2 instead

and indeed the following works

defmodule GradFun do
  import Nx.Defn

  defn my_function(x) do
    x
    |> Nx.cos()
    |> Nx.exp()
    |> Nx.sum()
    |> print_expr()
  end

  defn grad_my_function(x) do
    grad(x, &my_function/1) |> print_expr()
  end
end