Skip to content
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

Remove calls to deprecated function jax.lax.tie_in #981

Merged
merged 1 commit into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scenic/model_lib/layers/attention_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _attention_dropout(attn_weights: jnp.ndarray,
Returns:
Weights after dropout.
"""
keep_prob = jax.lax.tie_in(attn_weights, 1.0 - rate)
keep_prob = 1.0 - rate
if broadcast:
# Dropout is broadcast across the batch+head+non-attention dimension.
dropout_shape = list(attn_weights.shape)
Expand Down
6 changes: 4 additions & 2 deletions scenic/projects/vivit/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def factorized_dot_product_attention(
if not deterministic and dropout_rate > 0.:
if dropout_rng is None:
raise ValueError('Did not provide `rng` to dot_product_attention().')
keep_prob = jax.lax.tie_in(attn_weights, 1.0 - dropout_rate)
keep_prob = 1.0 - dropout_rate
if broadcast_dropout:
# Dropout is broadcast across the batch+head+non-attention dimension.
dropout_shape = list(attn_weights.shape)
Expand Down Expand Up @@ -547,7 +547,9 @@ def init_embedding(to_params, from_params, config):
'All filter dimensions besides the temporal dimension should be'
'equal. {} vs {}'.format(input_kernel.shape, restored_kernel.shape))

kernel_init_method = config.model.temporal_encoding_config.kernel_init_method
kernel_init_method = (
config.model.temporal_encoding_config.kernel_init_method
)
if kernel_init_method == 'average_frame_initializer':
# This corresponds to "filter inflation" in
# J Carreira and A Zisserman. Quo vadis, action recognition?
Expand Down