File size: 3,031 Bytes
fc0f7bd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | Utilities
=========
General
-------
.. currentmodule:: optax
.. autosummary::
scale_gradient
value_and_grad_from_state
Scale gradient
~~~~~~~~~~~~~~
.. autofunction:: scale_gradient
Value and grad from state
~~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: value_and_grad_from_state
Numerical Stability
-------------------
.. currentmodule:: optax
.. autosummary::
safe_int32_increment
safe_norm
safe_root_mean_squares
Safe int32 increment
~~~~~~~~~~~~~~~~~~~~
.. autofunction:: safe_int32_increment
Safe norm
~~~~~~~~~
.. autofunction:: safe_norm
Safe root mean squares
~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: safe_root_mean_squares
Linear Algebra Operators
------------------------
.. currentmodule:: optax
.. autosummary::
matrix_inverse_pth_root
multi_normal
power_iteration
Multi normal
~~~~~~~~~~~~
.. autofunction:: multi_normal
Matrix inverse pth root
~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: matrix_inverse_pth_root
Power iteration
~~~~~~~~~~~~~~~
.. autofunction:: power_iteration
Second Order Optimization
-------------------------
.. currentmodule:: optax.second_order
.. autosummary::
fisher_diag
hessian_diag
hvp
Fisher diagonal
~~~~~~~~~~~~~~~
.. autofunction:: fisher_diag
Hessian diagonal
~~~~~~~~~~~~~~~~
.. autofunction:: hessian_diag
Hessian vector product
~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: hvp
Tree
----
.. currentmodule:: optax.tree_utils
.. autosummary::
NamedTupleKey
tree_add
tree_add_scalar_mul
tree_div
tree_get
tree_get_all_with_path
tree_l1_norm
tree_l2_norm
tree_map_params
tree_mul
tree_ones_like
tree_random_like
tree_scalar_mul
tree_set
tree_sub
tree_sum
tree_vdot
tree_zeros_like
NamedTupleKey
~~~~~~~~~~~~~
.. autoclass:: NamedTupleKey
Tree add
~~~~~~~~
.. autofunction:: tree_add
Tree add and scalar multiply
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: tree_add_scalar_mul
Tree divide
~~~~~~~~~~~
.. autofunction:: tree_div
Fetch single value that match a given key
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: tree_get
Fetch all values that match a given key
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: tree_get_all_with_path
Tree l1 norm
~~~~~~~~~~~~
.. autofunction:: tree_l1_norm
Tree l2 norm
~~~~~~~~~~~~
.. autofunction:: tree_l2_norm
Tree map parameters
~~~~~~~~~~~~~~~~~~~
.. autofunction:: tree_map_params
Tree multiply
~~~~~~~~~~~~~
.. autofunction:: tree_mul
Tree ones like
~~~~~~~~~~~~~~
.. autofunction:: tree_ones_like
Tree with random values
~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: tree_random_like
Tree scalar multiply
~~~~~~~~~~~~~~~~~~~~
.. autofunction:: tree_scalar_mul
Set values in a tree
~~~~~~~~~~~~~~~~~~~~
.. autofunction:: tree_set
Tree subtract
~~~~~~~~~~~~~
.. autofunction:: tree_sub
Tree sum
~~~~~~~~
.. autofunction:: tree_sum
Tree inner product
~~~~~~~~~~~~~~~~~~
.. autofunction:: tree_vdot
Tree zeros like
~~~~~~~~~~~~~~~
.. autofunction:: tree_zeros_like
|