tf-models-nightly 2.17.0.dev20240423__py2.py3-none-any.whl → 2.17.0.dev20240425__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- official/vision/ops/preprocess_ops.py +2 -2
- official/vision/ops/preprocess_ops_test.py +16 -12
- {tf_models_nightly-2.17.0.dev20240423.dist-info → tf_models_nightly-2.17.0.dev20240425.dist-info}/METADATA +1 -1
- {tf_models_nightly-2.17.0.dev20240423.dist-info → tf_models_nightly-2.17.0.dev20240425.dist-info}/RECORD +8 -8
- {tf_models_nightly-2.17.0.dev20240423.dist-info → tf_models_nightly-2.17.0.dev20240425.dist-info}/AUTHORS +0 -0
- {tf_models_nightly-2.17.0.dev20240423.dist-info → tf_models_nightly-2.17.0.dev20240425.dist-info}/LICENSE +0 -0
- {tf_models_nightly-2.17.0.dev20240423.dist-info → tf_models_nightly-2.17.0.dev20240425.dist-info}/WHEEL +0 -0
- {tf_models_nightly-2.17.0.dev20240423.dist-info → tf_models_nightly-2.17.0.dev20240425.dist-info}/top_level.txt +0 -0
@@ -43,7 +43,7 @@ def clip_or_pad_to_fixed_size(input_tensor, size, constant_values=0):
|
|
43
43
|
Args:
|
44
44
|
input_tensor: `Tensor` with any dimension.
|
45
45
|
size: `int` number for the first dimension of output Tensor.
|
46
|
-
constant_values: `int` value assigned to the paddings.
|
46
|
+
constant_values: `int` or `str` value assigned to the paddings.
|
47
47
|
|
48
48
|
Returns:
|
49
49
|
`Tensor` with the first dimension padded to `size`.
|
@@ -66,7 +66,7 @@ def clip_or_pad_to_fixed_size(input_tensor, size, constant_values=0):
|
|
66
66
|
|
67
67
|
# Pads input tensor to the fixed first dimension.
|
68
68
|
paddings = tf.cast(
|
69
|
-
|
69
|
+
tf.fill(dims=padding_shape, value=constant_values), input_tensor.dtype
|
70
70
|
)
|
71
71
|
padded_tensor = tf.concat([input_tensor, paddings], axis=0)
|
72
72
|
output_shape = input_shape
|
@@ -36,30 +36,34 @@ def _encode_image(image_array, fmt):
|
|
36
36
|
class InputUtilsTest(parameterized.TestCase, tf.test.TestCase):
|
37
37
|
|
38
38
|
@parameterized.parameters(
|
39
|
-
([1], 10),
|
40
|
-
([1, 2], 10),
|
41
|
-
([1, 2, 3], 10),
|
42
|
-
([11], 10),
|
43
|
-
([12, 2], 10),
|
44
|
-
([13, 2, 3], 10),
|
39
|
+
([1], 10, 1.0, 0.0),
|
40
|
+
([1, 2], 10, 1.0, 0.0),
|
41
|
+
([1, 2, 3], 10, 1.0, 0.0),
|
42
|
+
([11], 10, 1.0, 0.0),
|
43
|
+
([12, 2], 10, 1.0, 0.0),
|
44
|
+
([13, 2, 3], 10, 1.0, 0.0),
|
45
|
+
([1, 2], 10, 'test', 'pad'),
|
45
46
|
)
|
46
|
-
def test_pad_to_fixed_size(
|
47
|
+
def test_pad_to_fixed_size(
|
48
|
+
self, input_shape, output_size, original_val, pad_val
|
49
|
+
):
|
47
50
|
# Copies input shape to padding shape.
|
48
51
|
clip_shape = input_shape[:]
|
49
52
|
clip_shape[0] = min(output_size, clip_shape[0])
|
50
53
|
padding_shape = input_shape[:]
|
51
54
|
padding_shape[0] = max(output_size - input_shape[0], 0)
|
52
55
|
expected_outputs = np.concatenate(
|
53
|
-
[np.
|
56
|
+
[np.full(clip_shape, original_val), np.full(padding_shape, pad_val)],
|
57
|
+
axis=0,
|
54
58
|
)
|
55
59
|
|
56
|
-
data = tf.
|
60
|
+
data = tf.fill(input_shape, original_val)
|
57
61
|
output_data = preprocess_ops.clip_or_pad_to_fixed_size(
|
58
|
-
data, output_size, constant_values=
|
62
|
+
data, output_size, constant_values=pad_val
|
59
63
|
)
|
60
64
|
output_data = output_data.numpy()
|
61
|
-
self.
|
62
|
-
self.
|
65
|
+
self.assertAllEqual(output_size, output_data.shape[0])
|
66
|
+
self.assertAllEqual(expected_outputs, output_data)
|
63
67
|
|
64
68
|
@parameterized.named_parameters(
|
65
69
|
dict(
|
@@ -1117,10 +1117,10 @@ official/vision/ops/iou_similarity_test.py,sha256=x5jlcMqMCUYC5cRgdbR0VlAW67AoXo
|
|
1117
1117
|
official/vision/ops/mask_ops.py,sha256=cZLpIowzEA57bXPDbVXa6mktZVHvGSH-TQ1CxHjpQXw,10270
|
1118
1118
|
official/vision/ops/mask_ops_test.py,sha256=D3xbbbleJd4HkpWOSDSEy6hNihsRBY93BqPF6JP-dJk,2835
|
1119
1119
|
official/vision/ops/nms.py,sha256=bKYDAtyV5j6PG7g-RGF2ZccCI5V1xVvuajNblCy1TGs,8125
|
1120
|
-
official/vision/ops/preprocess_ops.py,sha256=
|
1120
|
+
official/vision/ops/preprocess_ops.py,sha256=JnelXrBbfFkdyz5UbrZxnD_N4RdN_axFa7FNFxeSpdQ,42588
|
1121
1121
|
official/vision/ops/preprocess_ops_3d.py,sha256=o0ivTBK2BwaiPp_NhVG_yBc10VUySxfE7eKQkL7RNaU,16762
|
1122
1122
|
official/vision/ops/preprocess_ops_3d_test.py,sha256=LA3-Ue4FTjdsr5Kl_BnpAMNcfikWylMisD2GrBTOLzA,9309
|
1123
|
-
official/vision/ops/preprocess_ops_test.py,sha256=
|
1123
|
+
official/vision/ops/preprocess_ops_test.py,sha256=VXcILiqjWPcVHCVjx7i0iiPV6FP0s9pZ7LhXPwVPNHs,17392
|
1124
1124
|
official/vision/ops/sampling_ops.py,sha256=1jywCA_E4qDUFWsykCLUwZsWtQSR0QREXdJhvP5qCvc,16072
|
1125
1125
|
official/vision/ops/spatial_transform_ops.py,sha256=PVEJGAn0ygtsrid84vD5GgV0jsjyWoNn14RBzreMxM4,38389
|
1126
1126
|
official/vision/ops/target_gather.py,sha256=Ir3X76yXYEVFSYX5h-yfS8SMkY37GYuypBP2C8ykggo,3965
|
@@ -1206,9 +1206,9 @@ tensorflow_models/tensorflow_models_test.py,sha256=nc6A9K53OGqF25xN5St8EiWvdVbda
|
|
1206
1206
|
tensorflow_models/nlp/__init__.py,sha256=4tA5Pf4qaFwT-fIFOpX7x7FHJpnyJT-5UgOeFYTyMlc,807
|
1207
1207
|
tensorflow_models/uplift/__init__.py,sha256=mqfa55gweOdpKoaQyid4A_4u7xw__FcQeSIF0k_pYmI,999
|
1208
1208
|
tensorflow_models/vision/__init__.py,sha256=zBorY_v5xva1uI-qxhZO3Qh-Dii-Suq6wEYh6hKHDfc,833
|
1209
|
-
tf_models_nightly-2.17.0.
|
1210
|
-
tf_models_nightly-2.17.0.
|
1211
|
-
tf_models_nightly-2.17.0.
|
1212
|
-
tf_models_nightly-2.17.0.
|
1213
|
-
tf_models_nightly-2.17.0.
|
1214
|
-
tf_models_nightly-2.17.0.
|
1209
|
+
tf_models_nightly-2.17.0.dev20240425.dist-info/AUTHORS,sha256=1dG3fXVu9jlo7bul8xuix5F5vOnczMk7_yWn4y70uw0,337
|
1210
|
+
tf_models_nightly-2.17.0.dev20240425.dist-info/LICENSE,sha256=WxeBS_DejPZQabxtfMOM_xn8qoZNJDQjrT7z2wG1I4U,11512
|
1211
|
+
tf_models_nightly-2.17.0.dev20240425.dist-info/METADATA,sha256=vMmHziifUoAFoNJrYv0PNCkmAv4KkUw57jKbI2FqaHg,1432
|
1212
|
+
tf_models_nightly-2.17.0.dev20240425.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
|
1213
|
+
tf_models_nightly-2.17.0.dev20240425.dist-info/top_level.txt,sha256=gum2FfO5R4cvjl2-QtP-S1aNmsvIZaFFT6VFzU0f4-g,33
|
1214
|
+
tf_models_nightly-2.17.0.dev20240425.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|