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
da2d13b1
Commit
da2d13b1
authored
Oct 01, 2019
by
Sergey Mironov
Browse files
Fix bert_modeling error messages
parent
6bbc45dd
Changes
1
Show 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 @
da2d13b1
...
@@ -563,11 +563,11 @@ class Dense3D(tf.keras.layers.Layer):
...
@@ -563,11 +563,11 @@ class Dense3D(tf.keras.layers.Layer):
"""Implements build() for the layer."""
"""Implements build() for the layer."""
dtype
=
tf
.
as_dtype
(
self
.
dtype
or
tf
.
keras
.
backend
.
floatx
())
dtype
=
tf
.
as_dtype
(
self
.
dtype
or
tf
.
keras
.
backend
.
floatx
())
if
not
(
dtype
.
is_floating
or
dtype
.
is_complex
):
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 `Dense
3D
` layer with non-floating "
"dtype %s"
%
(
dtype
,))
"
point (and non-complex)
dtype %s"
%
(
dtype
,))
input_shape
=
tf
.
TensorShape
(
input_shape
)
input_shape
=
tf
.
TensorShape
(
input_shape
)
if
tf
.
compat
.
dimension_value
(
input_shape
[
-
1
])
is
None
:
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`."
)
"should be defined. Found `None`."
)
self
.
last_dim
=
tf
.
compat
.
dimension_value
(
input_shape
[
-
1
])
self
.
last_dim
=
tf
.
compat
.
dimension_value
(
input_shape
[
-
1
])
self
.
input_spec
=
tf
.
keras
.
layers
.
InputSpec
(
self
.
input_spec
=
tf
.
keras
.
layers
.
InputSpec
(
...
@@ -648,12 +648,14 @@ class Dense2DProjection(tf.keras.layers.Layer):
...
@@ -648,12 +648,14 @@ class Dense2DProjection(tf.keras.layers.Layer):
"""Implements build() for the layer."""
"""Implements build() for the layer."""
dtype
=
tf
.
as_dtype
(
self
.
dtype
or
tf
.
keras
.
backend
.
floatx
())
dtype
=
tf
.
as_dtype
(
self
.
dtype
or
tf
.
keras
.
backend
.
floatx
())
if
not
(
dtype
.
is_floating
or
dtype
.
is_complex
):
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
,))
"dtype %s"
%
(
dtype
,))
input_shape
=
tf
.
TensorShape
(
input_shape
)
input_shape
=
tf
.
TensorShape
(
input_shape
)
if
tf
.
compat
.
dimension_value
(
input_shape
[
-
1
])
is
None
:
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 "
"should be defined. Found `None`."
)
"`Dense2DProjection` should be defined. "
"Found `None`."
)
last_dim
=
tf
.
compat
.
dimension_value
(
input_shape
[
-
1
])
last_dim
=
tf
.
compat
.
dimension_value
(
input_shape
[
-
1
])
self
.
input_spec
=
tf
.
keras
.
layers
.
InputSpec
(
min_ndim
=
3
,
axes
=
{
-
1
:
last_dim
})
self
.
input_spec
=
tf
.
keras
.
layers
.
InputSpec
(
min_ndim
=
3
,
axes
=
{
-
1
:
last_dim
})
self
.
kernel
=
self
.
add_weight
(
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