DYS-Net
Bases: Module
, ABC
Abstract implementation of a Davis-Yin Splitting (DYS) layer in a neural network.
Note
The singular value decomposition of the matrix \(\mathsf{A}\) is used for the projection onto the subspace of all \(\mathsf{x}\) such that \(\mathsf{Ax=b}\).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
A |
tensor
|
Matrix for linear system |
required |
b |
tensor
|
Measurement vector for linear system |
required |
device |
string
|
Device on which to perform computations |
'mps'
|
alpha |
float
|
Step size for DYS updates |
0.05
|
Map Context Data to Gradient Parameters
Project onto \(C_1\)
Projection to the non-negative orthant.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
tensor
|
point in Euclidean space |
required |
Returns:
Name | Type | Description |
---|---|---|
Px |
tensor
|
projection of \(\mathsf{x}\) onto nonnegative orthant |
Project onto \(C_2\)
Projection to the subspace of all \(\mathsf{x}\) such that \(\mathsf{Ax=b}\).
Note
The singular value decomposition (SVD) representation of the matrix \(\mathsf{A}\) is used to efficiently compute the projection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
z |
tensor
|
point in Euclidean space |
required |
Returns:
Name | Type | Description |
---|---|---|
Pz |
tensor
|
projection onto subspace \(\mathsf{\{z : Ax = b\}}\) |
Source code in src/dys_opt_net.py
Gradient Operation
Gradient of objective function. Must be defined for each problem type.
Note
The parameters of \(\mathsf{F}\) are stored in \(\mathsf{w}\).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
z |
tensor
|
point in Euclidean space |
required |
w |
tensor
|
Parameters defining function and its gradient |
required |
Source code in src/dys_opt_net.py
Apply Optimization Layer
Apply a single update step from Davis-Yin Splitting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
z |
tensor
|
Point in Euclidean space |
required |
w |
tensor
|
Parameters defining function and its gradient |
required |
Returns:
Name | Type | Description |
---|---|---|
z |
tensor
|
Updated estimate of solution |
Source code in src/dys_opt_net.py
Train Time Forward
Default forward behaviour during training.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
d |
tensor
|
Contextual data |
required |
max_depth |
int
|
Maximum number of DYS updates |
int(10000.0)
|
depth_warning |
bool
|
Boolean for whether to print warning message when max depth reached |
True
|
Returns:
Name | Type | Description |
---|---|---|
z |
tensor
|
P+O Inference |
Source code in src/dys_opt_net.py
Test Time Forward
Forward propagation of DYS-net.
Note
A switch is included for using different behaviour at test/deployment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
d |
tensor
|
Contextual data |
required |
max_depth |
int
|
Maximum number of DYS updates |
int(10000.0)
|
depth_warning |
bool
|
Boolean for whether to print warning message when max depth reached |
True
|
Returns:
Name | Type | Description |
---|---|---|
z |
tensor
|
P+O Inference |