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
d48574cb
Commit
d48574cb
authored
Mar 12, 2021
by
Chen Chen
Committed by
A. Unique TensorFlower
Mar 12, 2021
Browse files
Use backticks to denote code spans in nlp modeling docstrings
PiperOrigin-RevId: 362610475
parent
454f8be7
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
official/nlp/modeling/networks/packed_sequence_embedding.py
official/nlp/modeling/networks/packed_sequence_embedding.py
+5
-5
official/nlp/modeling/networks/span_labeling.py
official/nlp/modeling/networks/span_labeling.py
+10
-10
No files found.
official/nlp/modeling/networks/packed_sequence_embedding.py
View file @
d48574cb
...
@@ -40,14 +40,14 @@ class PackedSequenceEmbedding(tf.keras.Model):
...
@@ -40,14 +40,14 @@ class PackedSequenceEmbedding(tf.keras.Model):
max_seq_length: The maximum sequence length for this encoder.
max_seq_length: The maximum sequence length for this encoder.
initializer: The initializer for the embedding portion of this encoder.
initializer: The initializer for the embedding portion of this encoder.
dropout_rate: The dropout rate to apply before the encoding layers.
dropout_rate: The dropout rate to apply before the encoding layers.
pack_multiple_sequences: If True, we can feed multiple sequences into one
pack_multiple_sequences: If
`
True
`
, we can feed multiple sequences into one
sequence for training and inference (they don't impact each other).
sequence for training and inference (they don't impact each other).
use_position_id: Whether to expect `position_ids` as an input to the
use_position_id: Whether to expect `position_ids` as an input to the
network. If False, the `position_ids` will be inferred: (1) when
network. If False, the `position_ids` will be inferred: (1) when
pack_multiple_sequences is False, we assume the position ids are 0, 1,
pack_multiple_sequences is False, we assume the position ids are
`
0, 1,
2, ..., seq_length - 1; (2) when pack_multiple_sequences is True,
there
2, ..., seq_length - 1
`
; (2) when
`
pack_multiple_sequences
`
is
`
True
`
,
may be multiple sub sequences, and for each sub sequence, its
position
there
may be multiple sub sequences, and for each sub sequence, its
ids start from 0, 1, 2, ...
position
ids start from 0, 1, 2, ...
"""
"""
def
__init__
(
self
,
def
__init__
(
self
,
...
...
official/nlp/modeling/networks/span_labeling.py
View file @
d48574cb
...
@@ -37,8 +37,8 @@ class SpanLabeling(tf.keras.Model):
...
@@ -37,8 +37,8 @@ class SpanLabeling(tf.keras.Model):
activation: The activation, if any, for the dense layer in this network.
activation: The activation, if any, for the dense layer in this network.
initializer: The initializer for the dense layer in this network. Defaults
initializer: The initializer for the dense layer in this network. Defaults
to a Glorot uniform initializer.
to a Glorot uniform initializer.
output: The output style for this network. Can be either
'
logits
'
or
output: The output style for this network. Can be either
`
logits
`
or
'
predictions
'
.
`
predictions
`
.
"""
"""
def
__init__
(
self
,
def
__init__
(
self
,
...
@@ -228,20 +228,20 @@ class XLNetSpanLabeling(tf.keras.layers.Layer):
...
@@ -228,20 +228,20 @@ class XLNetSpanLabeling(tf.keras.layers.Layer):
Args:
Args:
sequence_data: The input sequence data of shape
sequence_data: The input sequence data of shape
(batch_size, seq_length, input_width).
`
(batch_size, seq_length, input_width)
`
.
class_index: The class indices of the inputs of shape (batch_size,).
class_index: The class indices of the inputs of shape
`
(batch_size,)
`
.
paragraph_mask: Invalid position mask such as query and special symbols
paragraph_mask: Invalid position mask such as query and special symbols
(e.g. PAD, SEP, CLS) of shape (batch_size,).
(e.g. PAD, SEP, CLS) of shape
`
(batch_size,)
`
.
start_positions: The start positions of each example of shape
start_positions: The start positions of each example of shape
(batch_size,).
`
(batch_size,)
`
.
training: Whether or not this is the training phase.
training: Whether or not this is the training phase.
Returns:
Returns:
A dictionary with the keys
'
start_predictions
'
,
'
end_predictions
'
,
A dictionary with the keys
`
start_predictions
`
,
`
end_predictions
`
,
'
start_logits
'
,
'
end_logits
'
.
`
start_logits
`
,
`
end_logits
`
.
If inference, then
'
start_top_predictions
'
,
'
start_top_index
'
,
If inference, then
`
start_top_predictions
`
,
`
start_top_index
`
,
'
end_top_predictions
'
,
'
end_top_index
'
are also included.
`
end_top_predictions
`
,
`
end_top_index
`
are also included.
"""
"""
paragraph_mask
=
tf
.
cast
(
paragraph_mask
,
dtype
=
sequence_data
.
dtype
)
paragraph_mask
=
tf
.
cast
(
paragraph_mask
,
dtype
=
sequence_data
.
dtype
)
...
...
Prev
1
2
Next
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