tfmri.convex.ConvexFunction
tfmri.convex.ConvexFunction¶
- class ConvexFunction(domain_dimension=None, scale=None, dtype=None, name=None)[source]¶
Bases:
object
Base class defining a [batch of] convex function[s].
Represents a closed proper convex function \(f : \mathbb{R}^{n}\rightarrow \mathbb{R}\) or \(f : \mathbb{C}^{n}\rightarrow \mathbb{R}\).
Subclasses should implement the
_call
and_prox
methods to define the forward pass and the proximal mapping, respectively. Gradients are provided by TensorFlow’s automatic differentiation feature.This class exposes three properties to get static shape information:
shape
: The static shape. Calls_shape
.domain_dimension
: The static domain dimension, equal toshape[-1]
.batch_shape
: The static batch shape, equal toshape[:-1]
.
Additionally there are three equivalent methods to get dynamic shape information:
shape_tensor
: The dynamic shape. Calls_shape_tensor
.domain_dimension_tensor
: The dynamic domain dimension, equal toshape_tensor()[-1]
.batch_shape_tensor
: The dynamic batch shape, equal toshape_tensor()[:-1]
.
Subclasses may implement the methods
_shape
and_shape_tensor
to provide custom static and dynamic shape information, respectively.Initialize this
ConvexFunction
.- property batch_shape¶
The static batch shape of this
ConvexFunction
.
- batch_shape_tensor(name=None)[source]¶
Returns the dynamic batch shape of this
ConvexFunction
.Subclasses get this for free once they implement
_shape_tensor
.- Parameters
name – A name for this operation (optional).
- Returns
A 1D integer tf.Tensor.
- conj(name=None)[source]¶
Returns the convex conjugate of this
ConvexFunction
.- Parameters
name – A name for this operation (optional).
- Returns
A
ConvexFunction
which represents the convex conjugate ofself
.
- property domain_dimension¶
The static domain dimension of this
ConvexFunction
.
- domain_dimension_tensor(name=None)[source]¶
Returns the dynamic domain dimension of this
ConvexFunction
.Subclasses get this for free once they implement
_shape_tensor
.- Parameters
name – A name for this operation (optional).
- Returns
A scalar integer tf.Tensor.
- property dtype¶
The
DType
ofTensors
handled by thisConvexFunction
.
- property name¶
Name prepended to all ops created by this
ConvexFunction
.
- ndim_tensor(name=None)¶
Returns the dynamic domain dimension of this
ConvexFunction
. (deprecated)Deprecated: THIS FUNCTION IS DEPRECATED. It will be removed after 2022-08-07. Instructions for updating: Use
ConvexFunction.domain_dimension_tensor
instead.- Parameters
name – A name for this operation (optional).
- Returns
A scalar integer tf.Tensor.
- prox(x, scale=None, name=None, **kwargs)[source]¶
Evaluate the proximal operator of this
ConvexFunction
at point[s]x
.
- property scale¶
The scaling factor.
- property shape¶
The static shape of this
ConvexFunction
.