LostTech.TensorFlow : API Documentation

Type AffineLinearOperator

Namespace tensorflow.contrib.distributions.bijectors

Parent Bijector

Interfaces IAffineLinearOperator

Compute `Y = g(X; shift, scale) = scale @ X + shift`.

`shift` is a numeric `Tensor` and `scale` is a `LinearOperator`.

If `X` is a scalar then the forward transformation is: `scale * X + shift` where `*` denotes the scalar product.

Note: we don't always simply transpose `X` (but write it this way for brevity). Actually the input `X` undergoes the following transformation before being premultiplied by `scale`:

1. If there are no sample dims, we call `X = tf.expand_dims(X, 0)`, i.e., `new_sample_shape = [1]`. Otherwise do nothing. 2. The sample shape is flattened to have one dimension, i.e., `new_sample_shape = [n]` where `n = tf.reduce_prod(old_sample_shape)`. 3. The sample dim is cyclically rotated left by 1, i.e., `new_shape = [B1,...,Bb, k, n]` where `n` is as above, `k` is the event_shape, and `B1,...,Bb` are the batch shapes for each of `b` batch dimensions.

(For more details see `shape.make_batch_of_event_sample_matrices`.)

The result of the above transformation is that `X` can be regarded as a batch of matrices where each column is a draw from the distribution. After premultiplying by `scale`, we take the inverse of this procedure. The input `Y` also undergoes the same transformation before/after premultiplying by `inv(scale)`.

Example Use:
Show Example
linalg = tf.linalg 

x = [1., 2, 3]

shift = [-1., 0., 1] diag = [1., 2, 3] scale = linalg.LinearOperatorDiag(diag) affine = AffineLinearOperator(shift, scale) # In this case, `forward` is equivalent to: # y = scale @ x + shift y = affine.forward(x) # [0., 4, 10]

shift = [2., 3, 1] tril = [[1., 0, 0], [2, 1, 0], [3, 2, 1]] scale = linalg.LinearOperatorLowerTriangular(tril) affine = AffineLinearOperator(shift, scale) # In this case, `forward` is equivalent to: # np.squeeze(np.matmul(tril, np.expand_dims(x, -1)), -1) + shift y = affine.forward(x) # [3., 7, 11]

Properties

Public properties

object dtype get;

object dtype_dyn get;

object forward_min_event_ndims get;

object forward_min_event_ndims_dyn get;

IList<object> graph_parents get;

object graph_parents_dyn get;

object inverse_min_event_ndims get;

object inverse_min_event_ndims_dyn get;

bool is_constant_jacobian get;

object is_constant_jacobian_dyn get;

object name get;

object name_dyn get;

object PythonObject get;

object scale get;

The `scale` `LinearOperator` in `Y = scale @ X + shift`.

object scale_dyn get;

The `scale` `LinearOperator` in `Y = scale @ X + shift`.

object shift get;

The `shift` `Tensor` in `Y = scale @ X + shift`.

object shift_dyn get;

The `shift` `Tensor` in `Y = scale @ X + shift`.

bool validate_args get;

object validate_args_dyn get;