Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
3c227a73
Commit
3c227a73
authored
Apr 15, 2020
by
Hongkun Yu
Committed by
A. Unique TensorFlower
Apr 15, 2020
Browse files
Remove __init__ in CachedAttention, which is the same as its parent class.
PiperOrigin-RevId: 306748161
parent
26ea4d1a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
7 deletions
+1
-7
official/nlp/modeling/layers/attention.py
official/nlp/modeling/layers/attention.py
+1
-7
No files found.
official/nlp/modeling/layers/attention.py
View file @
3c227a73
...
...
@@ -186,15 +186,9 @@ class MultiHeadAttention(tf.keras.layers.Layer):
class
CachedAttention
(
MultiHeadAttention
):
"""Attention layer with cache used for auto-agressive decoding.
Arguments:
num_heads: Number of attention heads.
head_size: Size of each attention head.
**kwargs: Other keyword arguments inherit from `Attention` class.
Arguments are the same as `MultiHeadAttention` layer.
"""
def
__init__
(
self
,
num_heads
,
head_size
,
**
kwargs
):
super
(
CachedAttention
,
self
).
__init__
(
num_heads
,
head_size
,
**
kwargs
)
def
_update_cache
(
self
,
key_tensor
,
value_tensor
,
cache
,
decode_loop_step
):
"""Updates cache states and gets full-length key/value tensors."""
# Combines cached keys and values with new keys and values.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment