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
0f176f6f
Commit
0f176f6f
authored
Oct 03, 2019
by
A. Unique TensorFlower
Browse files
Merge pull request #7616 from Huawei-MRC-OSI:fix-bert-messages
PiperOrigin-RevId: 272700366
parents
73fcb8f5
da2d13b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
official/nlp/bert_modeling.py
official/nlp/bert_modeling.py
+8
-6
No files found.
official/nlp/bert_modeling.py
View file @
0f176f6f
...
...
@@ -563,11 +563,11 @@ class Dense3D(tf.keras.layers.Layer):
"""Implements build() for the layer."""
dtype
=
tf
.
as_dtype
(
self
.
dtype
or
tf
.
keras
.
backend
.
floatx
())
if
not
(
dtype
.
is_floating
or
dtype
.
is_complex
):
raise
TypeError
(
"Unable to build `Dense` layer with non-floating
point
"
"dtype %s"
%
(
dtype
,))
raise
TypeError
(
"Unable to build `Dense
3D
` layer with non-floating "
"
point (and non-complex)
dtype %s"
%
(
dtype
,))
input_shape
=
tf
.
TensorShape
(
input_shape
)
if
tf
.
compat
.
dimension_value
(
input_shape
[
-
1
])
is
None
:
raise
ValueError
(
"The last dimension of the inputs to `Dense` "
raise
ValueError
(
"The last dimension of the inputs to `Dense
3D
` "
"should be defined. Found `None`."
)
self
.
last_dim
=
tf
.
compat
.
dimension_value
(
input_shape
[
-
1
])
self
.
input_spec
=
tf
.
keras
.
layers
.
InputSpec
(
...
...
@@ -648,12 +648,14 @@ class Dense2DProjection(tf.keras.layers.Layer):
"""Implements build() for the layer."""
dtype
=
tf
.
as_dtype
(
self
.
dtype
or
tf
.
keras
.
backend
.
floatx
())
if
not
(
dtype
.
is_floating
or
dtype
.
is_complex
):
raise
TypeError
(
"Unable to build `Dense` layer with non-floating point "
raise
TypeError
(
"Unable to build `Dense2DProjection` layer with "
"non-floating point (and non-complex) "
"dtype %s"
%
(
dtype
,))
input_shape
=
tf
.
TensorShape
(
input_shape
)
if
tf
.
compat
.
dimension_value
(
input_shape
[
-
1
])
is
None
:
raise
ValueError
(
"The last dimension of the inputs to `Dense` "
"should be defined. Found `None`."
)
raise
ValueError
(
"The last dimension of the inputs to "
"`Dense2DProjection` should be defined. "
"Found `None`."
)
last_dim
=
tf
.
compat
.
dimension_value
(
input_shape
[
-
1
])
self
.
input_spec
=
tf
.
keras
.
layers
.
InputSpec
(
min_ndim
=
3
,
axes
=
{
-
1
:
last_dim
})
self
.
kernel
=
self
.
add_weight
(
...
...
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