-
Notifications
You must be signed in to change notification settings - Fork 19.6k
Split convolutional and pooling tests and parameterize tests #10975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split convolutional and pooling tests and parameterize tests #10975
Conversation
|
PEP8 fails due to |
747265f to
86a1efe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR.
| ] | ||
| ) | ||
| def test_causal_dilated_conv( | ||
| input_length, kernel_size, dilation_rate, padding, expected_output): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this parameterization pattern is not ideal for readability. It is not easy to assess at a glance what the tests cases are, and it is not easy to add new ones.
I suggest the following pattern for better readability:
@pytest.mark.parametrize('layer_kwargs,input_length,output_length',
[({'filters': 3, ...}, 5, 3),
...])
def test_causal_dilated_conv(layer_kwargs, input_shape, output_shape):
input_data = ...
expected_output = ...
layer_test(convolutional.Conv1D, input_data=input_data, kwargs=layer_kwargs, expected_output=expected_output)That way the different layer configurations are enumerated as dictionaries: you immediately know the value of each named argument.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, indeed. You approach is more readable. I will fix it later.
86a1efe to
6074223
Compare
6074223 to
4dab8ba
Compare
* keras/master: (327 commits) Added in_train_phase and in_test_phase in the numpy backend. (keras-team#11061) Make sure the data_format argument defaults to ‘chanels_last’ for all 1D sequence layers. Speed up backend tests (keras-team#11051) Skipped some duplicated tests. (keras-team#11049) Used decorators and WITH_NP to avoid tests duplication. (keras-team#11050) Cached the theano compilation directory. (keras-team#11048) Removing duplicated backend tests. (keras-team#11037) [P, RELNOTES] Conv2DTranspose supports dilation (keras-team#11029) Doc Change: Change in shape for CIFAR Datasets (keras-team#11043) Fix line too long in mnist_acgan (keras-team#11040) Enable using last incomplete minibatch (keras-team#8344) Better UX (keras-team#11039) Update lstm text generation example (keras-team#11038) fix a bug, load_weights doesn't return anything (keras-team#11031) Speeding up the tests by reducing the number of K.eval(). (keras-team#11036) [P] Expose monitor value getter for easier subclass (keras-team#11002) [RELNOTES] Added the mode "bilinear" in the upscaling2D layer. (keras-team#10994) Separate pooling test from convolutional test and parameterize test case (keras-team#10975) Fix issue with non-canonical TF version name format. Allow TB callback to display float values. ...
Summary
Split convolutional layers tests and pooling tests (currently both are in convolutional_test.py); make convolutional_test.py tests use parameterized tests instead of inner for loops for different cases.
Related Issues
PR Overview