Skip to content

Commit

Permalink
Wrap SequencePredictLast with tf.function (#1001)
Browse files Browse the repository at this point in the history
  • Loading branch information
edknv committed Feb 27, 2023
1 parent 63f5ee1 commit 5d0e090
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions merlin/models/tf/transforms/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ class SequencePredictLast(SequenceTransform):
so that the tensors sequences can be processed
"""

@tf.function
def call(
self, inputs: TabularData, targets=None, training=False, testing=False, **kwargs
) -> Tuple:
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/tf/blocks/test_mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ def test_mlp_model_with_sequential_features_and_combiner(
model, loader, run_eagerly=run_eagerly, reload_model=True, fit_kwargs={"pre": predict_last}
)

metrics = model.evaluate(loader, batch_size=8, steps=1, return_dict=True, pre=predict_last)
metrics = model.evaluate(loader, steps=1, return_dict=True, pre=predict_last)
assert len(metrics) > 0

predictions = model.predict(loader, batch_size=8, steps=1)
predictions = model.predict(loader, steps=1)
assert predictions.shape == (8, 51997)


Expand Down

0 comments on commit 5d0e090

Please sign in to comment.