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
ef6cb209
Unverified
Commit
ef6cb209
authored
Jan 27, 2020
by
George Sterpu
Committed by
GitHub
Jan 27, 2020
Browse files
Update beam_search.py
parent
6a3bcef8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
official/transformer/v2/beam_search.py
official/transformer/v2/beam_search.py
+7
-3
No files found.
official/transformer/v2/beam_search.py
View file @
ef6cb209
...
@@ -30,9 +30,13 @@ class SequenceBeamSearchV2(v1.SequenceBeamSearch):
...
@@ -30,9 +30,13 @@ class SequenceBeamSearchV2(v1.SequenceBeamSearch):
"""Beam search for sequences with highest scores."""
"""Beam search for sequences with highest scores."""
state
,
state_shapes
=
self
.
_create_initial_state
(
initial_ids
,
initial_cache
)
state
,
state_shapes
=
self
.
_create_initial_state
(
initial_ids
,
initial_cache
)
finished_state
=
tf
.
while_loop
(
finished_state
=
tf
.
nest
.
map_structure
(
self
.
_continue_search
,
self
.
_search_step
,
loop_vars
=
[
state
],
tf
.
stop_gradient
,
shape_invariants
=
[
state_shapes
],
parallel_iterations
=
1
,
back_prop
=
False
)
tf
.
while_loop
(
self
.
_continue_search
,
self
.
_search_step
,
loop_vars
=
[
state
],
shape_invariants
=
[
state_shapes
],
parallel_iterations
=
1
))
finished_state
=
finished_state
[
0
]
finished_state
=
finished_state
[
0
]
alive_seq
=
finished_state
[
_StateKeys
.
ALIVE_SEQ
]
alive_seq
=
finished_state
[
_StateKeys
.
ALIVE_SEQ
]
...
...
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