tfm.nlp.ops.get_next_sentence_labels
Stay organized with collections
Save and categorize content based on your preferences.
Extracts the next sentence label from sentences.
tfm.nlp.ops.get_next_sentence_labels(
sentences, random_threshold=0.5, random_fn=tf.random.uniform
)
Args |
sentences
|
A RaggedTensor of strings w/ shape [batch, (num_sentences)].
|
random_threshold
|
(optional) A float threshold between 0 and 1, used to
determine whether to extract a random sentence or the immediate next
sentence. Higher value favors next sentence.
|
random_fn
|
(optional) An op used to generate random float values.
|
Returns |
A tuple of (next_sentence_or_random, is_next_sentence) where:
|
next_sentence_or_random
|
A Tensor with shape [num_sentences] that
contains either the subsequent sentence of segment_a or a randomly
injected sentence.
|
is_next_sentence
|
A Tensor of bool w/ shape [num_sentences]
that contains whether or not next_sentence_or_random is truly a
subsequent sentence or not.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-02-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-02-02 UTC."],[],[]]