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
22b84f74
Commit
22b84f74
authored
Nov 21, 2019
by
Hongkun Yu
Committed by
A. Unique TensorFlower
Nov 21, 2019
Browse files
Transformer Nits: reshape -> set_shape
PiperOrigin-RevId: 281872406
parent
48693cad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
official/transformer/v2/transformer.py
official/transformer/v2/transformer.py
+4
-2
No files found.
official/transformer/v2/transformer.py
View file @
22b84f74
...
...
@@ -121,6 +121,7 @@ class Transformer(tf.keras.Model):
if
len
(
inputs
)
==
2
:
inputs
,
targets
=
inputs
[
0
],
inputs
[
1
]
else
:
# Decoding path.
inputs
,
targets
=
inputs
[
0
],
None
if
self
.
params
[
"padded_decode"
]:
if
not
self
.
params
[
"num_replicas"
]:
...
...
@@ -128,8 +129,9 @@ class Transformer(tf.keras.Model):
"Padded decoding on CPU/GPUs is not supported."
)
decode_batch_size
=
int
(
self
.
params
[
"decode_batch_size"
]
/
self
.
params
[
"num_replicas"
])
inputs
=
tf
.
reshape
(
inputs
,
[
decode_batch_size
,
self
.
params
[
"decode_max_length"
]])
inputs
.
set_shape
([
decode_batch_size
,
self
.
params
[
"decode_max_length"
]
])
# Variance scaling is used here because it seems to work in many problems.
# Other reasonable initializers may also work just as well.
...
...
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