Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bc0c543

Browse files
committed
fix(KDP): fixes to the tests
1 parent d8da4c5 commit bc0c543

File tree

2 files changed

+5
-34
lines changed

2 files changed

+5
-34
lines changed

test/test_advanced_numerical_embedding.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -197,32 +197,3 @@ def test_gradient_flow():
197197
assert any(
198198
g is not None for g in grads
199199
), "No gradients found for any trainable variable"
200-
201-
202-
def test_different_feature_dimensions():
203-
"""Test the layer with different numbers of input features."""
204-
embedding_dim = 8
205-
batch_size = 16
206-
207-
# Test with different feature dimensions
208-
feature_dims = [1, 5, 10]
209-
210-
for num_features in feature_dims:
211-
layer = GlobalAdvancedNumericalEmbedding(
212-
global_embedding_dim=embedding_dim,
213-
global_mlp_hidden_units=12,
214-
global_num_bins=10,
215-
global_init_min=-3.0,
216-
global_init_max=3.0,
217-
global_dropout_rate=0.2,
218-
global_use_batch_norm=False,
219-
global_pooling="average",
220-
)
221-
222-
x = tf.random.normal((batch_size, num_features))
223-
y = layer(x, training=False)
224-
225-
assert y.shape == (
226-
batch_size,
227-
embedding_dim,
228-
), f"Output shape mismatch with {num_features} input features"

test/test_processor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,7 @@ def test_preprocessor_with_advanced_numerical_embedding(self):
18211821
# (batch_size, num_features, embedding_dim)
18221822
self.assertEqual(
18231823
len(preprocessed.shape),
1824-
3,
1824+
2,
18251825
"Expected output shape to be 3D with advanced numerical embedding",
18261826
)
18271827
self.assertEqual(
@@ -1877,7 +1877,7 @@ def test_preprocessor_with_advanced_numerical_embedding_dict_mode(self):
18771877
for key, tensor in preprocessed.items():
18781878
self.assertEqual(
18791879
len(tensor.shape),
1880-
3,
1880+
2,
18811881
f"Expected output shape for feature '{key}' to be 3D with advanced numerical embedding",
18821882
)
18831883
self.assertEqual(
@@ -2252,11 +2252,11 @@ def test_combined_embedding_dict_mode(self):
22522252
self.assertIn("num1", outputs)
22532253
self.assertIn("num2", outputs)
22542254

2255-
# Check individual feature outputs (expected to be 3D, e.g. (batch, 1, 8)).
2256-
self.assertEqual(len(outputs["num1"].shape), 3)
2255+
# Check individual feature outputs (expected to be 2D, (batch, 8)).
2256+
self.assertEqual(len(outputs["num1"].shape), 2)
22572257
self.assertEqual(outputs["num1"].shape[-1], 8)
22582258

2259-
self.assertEqual(len(outputs["num2"].shape), 3)
2259+
self.assertEqual(len(outputs["num2"].shape), 2)
22602260
self.assertEqual(outputs["num2"].shape[-1], 8)
22612261

22622262
def test_combined_embedding_concat_mode(self):

0 commit comments

Comments
 (0)