Skip to content

Commit 862496f

Browse files
zoyahavtfx-copybara
authored andcommitted
Replace np.object type with object which is equivalent.
PiperOrigin-RevId: 479580624
1 parent 52e840d commit 862496f

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

tensorflow_transform/beam/bucketize_integration_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ def analyzer_fn(inputs):
699699
})
700700
# The expected data has 2 boundaries that divides the data into 3 buckets.
701701
expected_outputs = {
702-
'key_vocab': np.array([b'a', b'b'], np.object),
702+
'key_vocab': np.array([b'a', b'b'], object),
703703
'q_b': np.array([0., 1., 2.], np.float32),
704704
'scale_factor_per_key': np.array([0.0625, 0.05882353], np.float32),
705705
'shift_per_key': np.array([-1.0625, -2.88235283], np.float32),

tensorflow_transform/beam/impl_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,7 +2107,7 @@ def analyzer_fn(inputs):
21072107
'key': tf.io.FixedLenFeature([], tf.string)
21082108
})
21092109
expected_outputs = {
2110-
'key_vocab': np.array([b'a', b'b'], np.object),
2110+
'key_vocab': np.array([b'a', b'b'], object),
21112111
'mean': np.array([25, 75], np.float32),
21122112
'var': np.array([200, 216.67], np.float32)
21132113
}
@@ -2153,7 +2153,7 @@ def analyzer_fn(inputs):
21532153
'key': tf.io.FixedLenFeature([], tf.string)
21542154
})
21552155
expected_outputs = {
2156-
'key_vocab': np.array([b'a', b'b'], np.object),
2156+
'key_vocab': np.array([b'a', b'b'], object),
21572157
'mean': np.array([[3.0, -0.5], [5.0, 5.0]], np.float32),
21582158
'var': np.array([[25.0, 0.25], [25.0, 25.0]], np.float32)
21592159
}
@@ -2191,7 +2191,7 @@ def analyzer_fn(inputs):
21912191
}),
21922192
reduce_instance_dims=True,
21932193
expected_outputs={
2194-
'key_vocab': np.array([b'a', b'b'], np.object),
2194+
'key_vocab': np.array([b'a', b'b'], object),
21952195
'min_x_value': np.array([1, -2], np.float32),
21962196
'max_x_value': np.array([9, 4], np.float32),
21972197
}),
@@ -2225,7 +2225,7 @@ def analyzer_fn(inputs):
22252225
}),
22262226
reduce_instance_dims=False,
22272227
expected_outputs={
2228-
'key_vocab': np.array([b'a', b'b'], np.object),
2228+
'key_vocab': np.array([b'a', b'b'], object),
22292229
'min_x_value': np.array([[1, 5], [-2, 0]], np.float32),
22302230
'max_x_value': np.array([[5, 9], [2, 4]], np.float32),
22312231
}),
@@ -2255,7 +2255,7 @@ def analyzer_fn(inputs):
22552255
}),
22562256
reduce_instance_dims=True,
22572257
expected_outputs={
2258-
'key_vocab': np.array([b'a', b'b'], np.object),
2258+
'key_vocab': np.array([b'a', b'b'], object),
22592259
'min_x_value': np.array([1, -3], np.float32),
22602260
'max_x_value': np.array([5, 3], np.float32),
22612261
}),
@@ -2286,7 +2286,7 @@ def analyzer_fn(inputs):
22862286
reduce_instance_dims=False,
22872287
expected_outputs={
22882288
'key_vocab':
2289-
np.array([b'a', b'b'], np.object),
2289+
np.array([b'a', b'b'], object),
22902290
'min_x_value':
22912291
np.array([[[1, 1], [1, 1]], [[3, -3], [3, 3]]], np.float32),
22922292
'max_x_value':
@@ -2390,7 +2390,7 @@ def preprocessing_fn(inputs):
23902390
input_metadata=tft.DatasetMetadata.from_feature_spec(
23912391
{'key': tf.io.FixedLenFeature([], tf.string)}),
23922392
expected_outputs={
2393-
'elements': np.array([b'a', b'b'], np.object),
2393+
'elements': np.array([b'a', b'b'], object),
23942394
'counts': np.array([25, 75], np.int64)
23952395
}),
23962396
dict(
@@ -2481,7 +2481,7 @@ def analyzer_fn(inputs):
24812481
tf.compat.as_bytes(str(x % 10) + '_')
24822482
for x in range(10)
24832483
]),
2484-
dtype=np.object)
2484+
dtype=object)
24852485
},
24862486
),
24872487
dict(

tensorflow_transform/impl_helper_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@
239239
'varlen':
240240
tf.compat.v1.SparseTensorValue(
241241
indices=np.array([(0, 0), (2, 0)]),
242-
values=np.array([b'a', b'b'], np.object),
242+
values=np.array([b'a', b'b'], object),
243243
dense_shape=(4, 1)),
244244
}),
245245
dict(
@@ -259,7 +259,7 @@
259259
'sparse':
260260
tf.compat.v1.SparseTensorValue(
261261
indices=np.empty([0, 2]),
262-
values=np.array([], np.object),
262+
values=np.array([], object),
263263
dense_shape=[1, 10])
264264
}),
265265
dict(

tensorflow_transform/test_case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def assertDataCloseOrEqual(self, a_data, b_data):
303303
def _assertValuesCloseOrEqual(self, a_value, b_value, msg=None):
304304
if (isinstance(a_value, (bytes, str)) or isinstance(a_value, list) and
305305
a_value and isinstance(a_value[0], (bytes, str)) or
306-
isinstance(a_value, np.ndarray) and a_value.dtype == np.object):
306+
isinstance(a_value, np.ndarray) and a_value.dtype == object):
307307
self.assertAllEqual(a_value, b_value)
308308
else:
309309
# TODO(varshaan): Change atol only for tests for which 1e-6 is too strict.

0 commit comments

Comments
 (0)