Sparsity Detection¶
asdex.jacobian_sparsity(f, *args, argnums=0, has_aux=False)
¶
Detect global Jacobian sparsity pattern for f.
Analyzes the computation graph structure directly, without evaluating any derivatives. The result is valid for all inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
Callable
|
Function whose Jacobian sparsity pattern is to be detected. |
required |
*args
|
Any
|
Sample arguments of |
()
|
argnums
|
int | Sequence[int]
|
Specifies which positional argument(s) to differentiate
with respect to (default |
0
|
has_aux
|
bool
|
Whether |
False
|
Returns:
| Type | Description |
|---|---|
SparsityPattern
|
SparsityPattern of shape |
asdex.hessian_sparsity(f, *args, argnums=0, has_aux=False)
¶
Detect global Hessian sparsity pattern for a scalar-valued f.
Analyzes the Jacobian sparsity of the gradient function, without evaluating any derivatives. The result is valid for all inputs.
If f returns a squeezable shape like (1,) or (1, 1),
it is automatically squeezed to scalar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
Callable
|
Scalar-valued function taking one or more positional arrays. |
required |
*args
|
Any
|
Sample arguments of |
()
|
argnums
|
int | Sequence[int]
|
Specifies which positional argument(s) to differentiate
with respect to (default |
0
|
has_aux
|
bool
|
Whether |
False
|
Returns:
| Type | Description |
|---|---|
SparsityPattern
|
Square SparsityPattern over the combined, selected input space. |