Repository navigation
fix: read static shapes in spectral pooling and accept layer kwargs - #42
Open
ColumbusLabs wants to merge 1 commit into
Open
ColumbusLabs wants to merge 1 commit into
ColumbusLabs wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #36
SpectralPooling1DandSpectralPooling2Dcould not be used with TensorFlow's Keras:call()readx._keras_shape, which only standalone Keras 1 set, so both layers raisedAttributeErrorwhen called.SpectralPooling1D.__init__tooktopfas a named argument with an unused default and then looked for it in**kwargs, soSpectralPooling1D(topf=...)always raised "Must provide either topf= or gamma= !".Layer.__init__, soname=and the other standard layer arguments were dropped.Changes (
complexnn/pool.pyonly)tuple(x.shape)via a small_static_shapehelper, which raises aValueErrorif a spatial dimension isNone(the masks are built from the static size).__init__methods taketopf=Noneandgamma=Noneexplicitly and forward the remaining kwargs tosuper().__init__. Calling with neither still raises the sameRuntimeError.fftmodule is untouched.Tests
tests/test_pool.py: builds and trains a one-step model with each layer usingtopf=andgamma=, checks the output mask, checksname=is forwarded, and checks theValueErrorfor an unknown spatial dimension.TestNoKerasShapeWritesintests/test_public_api.pyis nowTestNoKerasShapeUseand also catches reads of_keras_shape, not just writes.pytest tests/test_pool.py tests/test_public_api.py:TF_USE_LEGACY_KERAS=1ruff checkandruff format --checkpass on the changed files.