split = tfb.Split(
num_or_size_splits=[4, 1, 3],
axis=-1
)
y = split.forward(tf.zeros([5, 6, 8]))
==> [<`Tensor`, shape=(5, 6, 4)>,
<`Tensor`, shape=(5, 6, 1)>,
<`Tensor`, shape=(5, 6, 3)>]
# The inverse of `split` concatenates a list of `Tensor`s along `axis`.
x_ = split.inverse(y_)
x_.shape
==> TensorShape([5, 6, 8])
Args
num_or_size_splits
Either a Python integer indicating the number of
splits along axis or a 1-D integer Tensor or Python list containing
the sizes of each output tensor along axis. If a list/Tensor, it may
contain at most one value of -1, which indicates a split size that is
unknown and determined from input.
axis
A negative integer or scalar int32Tensor. The dimension along
which to split. Must be negative to enable the bijector to support
arbitrary batch dimensions. Defaults to -1 (note that this is different
from the tf.Split default of 0). Must be statically known.
validate_args
Python bool indicating whether arguments should
be checked for correctness.
name
Python str, name given to ops managed by this object.
Attributes
axis
dtype
dtype of Tensors transformable by this distribution.
forward_min_event_ndims
Returns the minimal number of dimensions bijector.forward operates on.
graph_parents
Returns this Bijector's graph_parents as a Python list.
inverse_min_event_ndims
Returns the minimal number of dimensions bijector.inverse operates on.
is_constant_jacobian
Returns true iff the Jacobian matrix is not a function of x.
name
Returns the string name of this Bijector.
num_splits
parameters
Dictionary of parameters used to instantiate this Bijector.
split_sizes
trainable_variables
validate_args
Returns True if Tensor arguments will be validated.
Shape of a single sample from a single batch as a list of TensorShapes.
Same meaning as forward_event_shape_tensor. May be only partially defined.
Args
input_shape
TensorShape indicating event-portion shape passed into
forward function.
Returns
forward_event_shape
A list of (possibly unknown) TensorShapes
indicating event-portion shape after applying forward. The length of
the list is equal to the number of splits.
Tensor. The input to the 'forward' Jacobian determinant evaluation.
event_ndims
Number of dimensions in the probabilistic events being
transformed. Must be greater than or equal to
self.forward_min_event_ndims. The result is summed over the final
dimensions to produce a scalar Jacobian determinant for each event, i.e.
it has shape rank(x) - event_ndims dimensions.
name
The name to give this op.
Returns
Tensor, if this bijector is injective.
If not injective this is not implemented.
Shape of a single sample from a single batch as an int32 1D Tensor.
Args
output_shapes
An iterable of Tensor, int32 vectors indicating
event-shapes passed into inverse function. The length of the iterable
must be equal to the number of splits.
name
Name to give to the op.
Returns
inverse_event_shape_tensor
Tensor, int32 vector indicating
event-portion shape after applying inverse.
Note that forward_log_det_jacobian is the negative of this function,
evaluated at g^{-1}(y).
Args
y
Tensor. The input to the 'inverse' Jacobian determinant evaluation.
event_ndims
Number of dimensions in the probabilistic events being
transformed. Must be greater than or equal to
self.inverse_min_event_ndims. The result is summed over the final
dimensions to produce a scalar Jacobian determinant for each event, i.e.
it has shape rank(y) - event_ndims dimensions.
name
The name to give this op.
**kwargs
Named arguments forwarded to subclass implementation.
Returns
ildj
Tensor, if this bijector is injective.
If not injective, returns the tuple of local log det
Jacobians, log(det(Dg_i^{-1}(y))), where g_i is the restriction
of g to the ith partition Di.
Raises
TypeError
if self.dtype is specified and y.dtype is not
self.dtype.