Skip to content

Commit b98a3e7

Browse files
iindyktf-transform-team
authored andcommitted
Addressing a todo: keeping the quantiles output dtype as float for all numeric input types for backwards compatibility since this has no effect on the performance atm.
PiperOrigin-RevId: 402340365
1 parent aa2daff commit b98a3e7

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

tensorflow_transform/analyzers.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,10 +2150,8 @@ def quantiles(x: tf.Tensor,
21502150
shape x.shape + [num_bucket-1].
21512151
See code below for discussion on the type of bucket boundaries.
21522152
"""
2153-
# TODO(b/64039847): quantile ops only support float bucket boundaries as this
2154-
# triggers an assertion in MakeQuantileSummaries().
2155-
# The restriction does not apply to inputs, which can be of any integral
2156-
# dtype including tf.int32, tf.int64, tf.flost64 and tf.double.
2153+
# Quantile ops convert input values to double under the hood. Keep bucket
2154+
# boundaries as float for all numeric types.
21572155
bucket_dtype = tf.float32
21582156
with tf.compat.v1.name_scope(name, 'quantiles'):
21592157
if weights is None:
@@ -2212,10 +2210,8 @@ def _quantiles_per_key(x, key, num_buckets, epsilon, name=None):
22122210
"""
22132211
if key.dtype != tf.string:
22142212
raise ValueError('key must have type tf.string')
2215-
# TODO(b/64039847): quantile ops only support float bucket boundaries as this
2216-
# triggers an assertion in MakeQuantileSummaries().
2217-
# The restriction does not apply to inputs, which can be of any integral
2218-
# dtype including tf.int32, tf.int64, tf.flost64 and tf.double.
2213+
# Quantile ops convert input values to double under the hood. Keep bucket
2214+
# boundaries as float for all numeric types.
22192215
bucket_dtype = tf.float32
22202216
with tf.compat.v1.name_scope(name, 'quantiles_by_key'):
22212217
combiner = QuantilesCombiner(

0 commit comments

Comments
 (0)