Fix #418: add tests for tfq_utility_ops.padded_to_ragged2d#1068
Conversation
This adds some simple tests for an untested function in `tfq_utility_ops_test.py`.
There was a problem hiding this comment.
Code Review
This pull request updates tfq_utility_ops_test.py by correcting a typo, adding more test cases to test_padded_to_ragged, and implementing a new test for padded_to_ragged2d. Feedback indicates that the logic in test_padded_to_ragged2d contains an error in tensor slicing that only works for square matrices and suggests that the test implementation is too similar to the actual code, potentially missing bugs.
tfq_utility_ops_test.py
tfq_utility_ops_test.pytfq_utility_ops.padded_to_ragged2d
tfq_utility_ops.padded_to_ragged2dtfq_utility_ops.padded_to_ragged2d
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request expands the test suite for utility operations by adding new test cases to test_padded_to_ragged and introducing the test_padded_to_ragged2d method. Feedback suggests that the current test cases for test_padded_to_ragged2d are symmetric, which may fail to reveal an implementation bug where the first row is incorrectly used for masking instead of the first column. Including non-symmetric test cases is recommended to ensure the utility operation is correctly verified.
This adds some tests for previously-untested
tfq_utility_ops.padded_to_ragged2dand also adds a few more cases to existing tests fortfq_utility_ops.padded_to_ragged.