Skip to content

Commit 1bf3601

Browse files
iindyktfx-copybara
authored andcommitted
Disables expensive validation in RaggedTensor factories.
They produce RaggedTensors from existing by changing values (but not values shape). The row splits will be valid as long as input RaggedTensors are valid. PiperOrigin-RevId: 472779047
1 parent a9d0d48 commit 1bf3601

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

tensorflow_transform/mappers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,8 @@ def _make_composite_tensor_wrapper_if_composite(
18261826
elif isinstance(x, tf.RaggedTensor):
18271827

18281828
def from_nested_row_splits(values):
1829-
return tf.RaggedTensor.from_nested_row_splits(values, x.nested_row_splits)
1829+
return tf.RaggedTensor.from_nested_row_splits(
1830+
values, x.nested_row_splits, validate=False)
18301831

18311832
return from_nested_row_splits
18321833
else:

tensorflow_transform/tf_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def _to_string(x: common_types.TensorType) -> common_types.TensorType:
470470
dense_shape=x.dense_shape)
471471
elif isinstance(x, tf.RaggedTensor):
472472
return tf.RaggedTensor.from_row_splits(
473-
values=_to_string(x.values), row_splits=x.row_splits)
473+
values=_to_string(x.values), row_splits=x.row_splits, validate=False)
474474
else:
475475
return tf.strings.as_string(x)
476476

0 commit comments

Comments
 (0)