# 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 = `. 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] ```

### Public properties

#### objectscale get;

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

#### objectscale_dyn get;

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

#### objectshift get;

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

#### objectshift_dyn get;

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