|
2 | 2 |
|
3 | 3 | ## Operators |
4 | 4 |
|
5 | | -Depending on the type of input and output, differentiation operators can have various names. |
| 5 | +The name of the differentiation operators can vary depending on the type of the input `x` and the type of the output `y` of the function being differentiated. |
6 | 6 |
|
7 | 7 | We provide the following high-level operators: |
8 | 8 |
|
9 | | -| operator | order | input `x` | output `y` | result type | result shape | |
10 | | -| :-------------------------- | :---- | :-------------- | :-------------------------- | :--------------- | :----------------------- | |
11 | | -| [`derivative`](@ref) | 1 | `Number` | `Number` or `AbstractArray` | same as `y` | `size(y)` | |
12 | | -| [`second_derivative`](@ref) | 2 | `Number` | `Number` or `AbstractArray` | same as `y` | `size(y)` | |
13 | | -| [`gradient`](@ref) | 1 | `AbstractArray` | `Number` | same as `x` | `size(x)` | |
14 | | -| [`hessian`](@ref) | 2 | `AbstractArray` | `Number` | `AbstractMatrix` | `(length(x), length(x))` | |
15 | | -| [`jacobian`](@ref) | 1 | `AbstractArray` | `AbstractArray` | `AbstractMatrix` | `(length(y), length(x))` | |
| 9 | +| operator | order | input `x` | output `y` | operator result type | operator result shape | |
| 10 | +| :-------------------------- | :---- | :-------------- | :-------------------------- | :------------------- | :----------------------- | |
| 11 | +| [`derivative`](@ref) | 1 | `Number` | `Number` or `AbstractArray` | same as `y` | `size(y)` | |
| 12 | +| [`second_derivative`](@ref) | 2 | `Number` | `Number` or `AbstractArray` | same as `y` | `size(y)` | |
| 13 | +| [`gradient`](@ref) | 1 | `AbstractArray` | `Number` | same as `x` | `size(x)` | |
| 14 | +| [`hessian`](@ref) | 2 | `AbstractArray` | `Number` | `AbstractMatrix` | `(length(x), length(x))` | |
| 15 | +| [`jacobian`](@ref) | 1 | `AbstractArray` | `AbstractArray` | `AbstractMatrix` | `(length(y), length(x))` | |
16 | 16 |
|
17 | 17 | They can be derived from lower-level operators: |
18 | 18 |
|
19 | | -| operator | order | input `x` | output `y` | seed `v` | result type | result shape | |
20 | | -| :----------------------------- | :---- | :-------------- | :----------- | :------- | :---------- | :----------- | |
21 | | -| [`pushforward`](@ref) (or JVP) | 1 | `Any` | `Any` | `dx` | same as `y` | `size(y)` | |
22 | | -| [`pullback`](@ref) (or VJP) | 1 | `Any` | `Any` | `dy` | same as `x` | `size(x)` | |
23 | | -| [`hvp`](@ref) | 2 | `AbstractArray` | `Number` | `dx` | same as `x` | `size(x)` | |
| 19 | +| operator | order | input `x` | output `y` | seed `v` | operator result type | operator result shape | |
| 20 | +| :----------------------------- | :---- | :-------------- | :----------- | :------- | :------------------- | :-------------------- | |
| 21 | +| [`pushforward`](@ref) (or JVP) | 1 | `Any` | `Any` | `dx` | same as `y` | `size(y)` | |
| 22 | +| [`pullback`](@ref) (or VJP) | 1 | `Any` | `Any` | `dy` | same as `x` | `size(x)` | |
| 23 | +| [`hvp`](@ref) | 2 | `AbstractArray` | `Number` | `dx` | same as `x` | `size(x)` | |
24 | 24 |
|
25 | 25 | Luckily, most backends have custom implementations, which we reuse if possible instead of relying on fallbacks. |
26 | 26 |
|
|
0 commit comments