Skip to content

Commit 0f176f6

Browse files
Merge pull request #7616 from Huawei-MRC-OSI:fix-bert-messages
PiperOrigin-RevId: 272700366
2 parents 73fcb8f + da2d13b commit 0f176f6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

official/nlp/bert_modeling.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,11 @@ def build(self, input_shape):
563563
"""Implements build() for the layer."""
564564
dtype = tf.as_dtype(self.dtype or tf.keras.backend.floatx())
565565
if not (dtype.is_floating or dtype.is_complex):
566-
raise TypeError("Unable to build `Dense` layer with non-floating point "
567-
"dtype %s" % (dtype,))
566+
raise TypeError("Unable to build `Dense3D` layer with non-floating "
567+
"point (and non-complex) dtype %s" % (dtype,))
568568
input_shape = tf.TensorShape(input_shape)
569569
if tf.compat.dimension_value(input_shape[-1]) is None:
570-
raise ValueError("The last dimension of the inputs to `Dense` "
570+
raise ValueError("The last dimension of the inputs to `Dense3D` "
571571
"should be defined. Found `None`.")
572572
self.last_dim = tf.compat.dimension_value(input_shape[-1])
573573
self.input_spec = tf.keras.layers.InputSpec(
@@ -648,12 +648,14 @@ def build(self, input_shape):
648648
"""Implements build() for the layer."""
649649
dtype = tf.as_dtype(self.dtype or tf.keras.backend.floatx())
650650
if not (dtype.is_floating or dtype.is_complex):
651-
raise TypeError("Unable to build `Dense` layer with non-floating point "
651+
raise TypeError("Unable to build `Dense2DProjection` layer with "
652+
"non-floating point (and non-complex) "
652653
"dtype %s" % (dtype,))
653654
input_shape = tf.TensorShape(input_shape)
654655
if tf.compat.dimension_value(input_shape[-1]) is None:
655-
raise ValueError("The last dimension of the inputs to `Dense` "
656-
"should be defined. Found `None`.")
656+
raise ValueError("The last dimension of the inputs to "
657+
"`Dense2DProjection` should be defined. "
658+
"Found `None`.")
657659
last_dim = tf.compat.dimension_value(input_shape[-1])
658660
self.input_spec = tf.keras.layers.InputSpec(min_ndim=3, axes={-1: last_dim})
659661
self.kernel = self.add_weight(

0 commit comments

Comments
 (0)