This repository was archived by the owner on May 21, 2025. It is now read-only.
Fix passing of keyword args to Dense layers in create_tower#339
Open
b4russell wants to merge 1 commit intotensorflow:masterfrom
Open
Fix passing of keyword args to Dense layers in create_tower#339b4russell wants to merge 1 commit intotensorflow:masterfrom
b4russell wants to merge 1 commit intotensorflow:masterfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Current behavior: kwargs are passed to tf.keras.Sequential.add, so they
are not passed on to tf.keras.layers.Dense as intended. For example,
when passing `use_bias=False` to create_tower with the kwarg name
`kernel_regularizer`, it throws an exception:
Traceback (most recent call last):
File "/Users/brussell/development/ranking/tensorflow_ranking/python/keras/layers_test.py", line 33, in test_create_tower_with_kwargs
tower = layers.create_tower([3, 2, 1], 1, activation='relu', use_bias=False)
File "/Users/brussell/development/ranking/tensorflow_ranking/python/keras/layers.py", line 70, in create_tower
model.add(tf.keras.layers.Dense(units=layer_width), **kwargs)
File "/usr/local/anaconda3/lib/python3.9/site-packages/tensorflow/python/trackable/base.py", line 205, in _method_wrapper
result = method(self, *args, **kwargs)
File "/usr/local/anaconda3/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 61, in error_handler
return fn(*args, **kwargs)
TypeError: add() got an unexpected keyword argument 'use_bias'
test_create_tower_with_kwargs
Fix: This PR fixes the behavior by shifting the closing paren of
tf.keras.layers.Dense to the correct location.
49377e8 to
1400f70
Compare
Author
|
Hi! I want to follow up on this PR, which has been open for a year. Are you interested in fixing this behavior or should I close the PR? Tagging @lyyanlely , since you incorporated my colleague @JackGammack PR recently. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Current behavior: kwargs are passed to tf.keras.Sequential.add, so they are not passed on to tf.keras.layers.Dense as intended. For example, when passing
use_bias=Falseto create_tower with the kwarg namekernel_regularizer, it throws an exception:Fix: This PR fixes the behavior by shifting the closing paren of tf.keras.layers.Dense to the correct location.