|  View source on GitHub | 
Maps inputs through a CDF function specified by keypoint parameters.
@tf.functiontfl.conditional_cdf.cdf_fn( inputs: tf.Tensor, location_parameters: tf.Tensor, scaling_parameters: Optional[tf.Tensor] = None, units: int = 1, activation: str = 'relu6', reduction: str = 'mean', sparsity_factor: int = 1, scaling_exp_transform_multiplier: Optional[float] = None, return_derived_parameters: bool = False ) -> Union[tf.Tensor, Tuple[tf.Tensor, tf.Tensor, tf.Tensor]]
cdf_fn is similar to tfl.layers.CDF, which is an additive / multiplicative
average of a few shifted and scaled sigmoid or relu6 basis functions,
with the difference that the functions are parametrized by the provided
parameters instead of learnable weights belonging to a tfl.layers.CDF layer.
These parameters can be one of:
- constants,
- trainable variables,
- outputs from other TF modules.
For inputs of shape (batch_size, input_dim), two sets of free-form
parameters are used to configure the CDF function:
- location_parametersfor where to place the sigmoid / relu6 transformation basis,
- scaling_parameters(optional) for the horizontal scaling before applying the transformation basis.
The transformation per dimension is x -> activation(scale * (x - location)),
where:
- scale(specified via- scaling_parameter) is the input scaling for each dimension and needs to be strictly positive for the CDF function to become monotonic. If needed, you can set- scaling_exp_transform_multiplierto get- scale = exp(scaling_parameter * scaling_exp_transform_multiplier)and guarantees strict positivity.
- location(specified via- location_parameter) is the input shift. Notice for- relu6this is where the transformation starts to be nonzero, whereas for- sigmoidthis is where the transformation hits 0.5.
- activationis either- sigmoidor- relu6(for- relu6 / 6).
An optional reduction operation will compute the additive / multiplicative
average for the input dims after their individual CDF transformation. mean
and geometric_mean are supported if sepcified.
sparsity_factor decides the level of sparsity during reduction. For
instance, default of sparsity = 1 calculates the average of all input
dims, whereas sparsity = 2 calculates the average of every other input
dim, and so on.
| Input shape | |
|---|---|
| We denote num_functionsas the number ofsigmoidorrelu6 / 6basis
functions used for each CDF transformation.
 
 
 
 
 
 | 
| Returns | |
|---|---|
| If return_derived_parameters = False:
 If  
 |