Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Args:
support: Tensor defining support of a categorical distribution(s). Must be
of rank 1 or of the same rank as `weights`. The size of the last dimension
has to match that of `weights`.
weights: Tensor defining weights on the support points.
new_support: Tensor holding positions of a new support.
reverse: Whether to evalute cumulative from the left or right.
Returns:
Cumulative distribution on the supplied support.
The foolowing invariant is maintained across the last dimension:
result[i] = (sum_j weights[j] for all j where support[j] < new_support[i])
if reverse == False else
(sum_j weights[j] for all j where support[j] > new_support[i])
"""
return gen_distribution_ops.project_distribution(
support, weights, new_support, 3 if reverse else 2)
def l2_project(support, weights, new_support):
"""Projects distribution (support, weights) onto new_support.
Args:
support: Tensor defining support of a categorical distribution(s). Must be
of rank 1 or of the same rank as `weights`. The size of the last dimension
has to match that of `weights`.
weights: Tensor defining weights on the support points.
new_support: Tensor holding positions of a new support.
Returns:
Projection of (support, weights) onto the new_support.
"""
return gen_distribution_ops.project_distribution(
support, weights, new_support, 1)