tensorflow:: אופס:: ResourceScatterNdUpdate
#include <state_ops.h>
מחיל updates
דלילים על ערכים או פרוסות בודדות בתוך נתון.
תַקצִיר
משתנה לפי indices
.
ref
הוא Tensor
עם דרגה P
indices
הוא Tensor
בדרגה Q
indices
חייבים להיות טנסור שלמים, המכיל מדדים לתוך ref
. זה חייב להיות צורה [d_0, ..., d_{Q-2}, K]
כאשר 0 < K <= P
.
הממד הפנימי ביותר של indices
(עם אורך K
) מתאים למדדים לאלמנטים (אם K = P
) או לפרוסות (אם K < P
) לאורך הממד K
של ref
.
updates
הם Tensor
בדרגה Q-1+PK
עם צורה:
[d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]].
לדוגמה, נניח שאנו רוצים לעדכן 4 אלמנטים מפוזרים לטנזור דרגה 1 ל-8 אלמנטים. ב-Python, העדכון הזה ייראה כך:
ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8])
indices = tf.constant([[4], [3], [1] ,[7]])
updates = tf.constant([9, 10, 11, 12])
update = tf.scatter_nd_update(ref, indices, updates)
with tf.Session() as sess:
print sess.run(update)
העדכון שיתקבל ל-ref ייראה כך:
[1, 11, 3, 10, 9, 6, 7, 12]
ראה tf.scatter_nd
לפרטים נוספים על איך לבצע עדכונים לפרוסות.
טיעונים:
- scope: אובייקט Scope
- ref: ידית משאבים. חייב להיות מ-VarHandleOp.
- מדדים: A Tensor . חייב להיות אחד מהסוגים הבאים: int32, int64. טנזור של מדדים לתוך ref.
- עדכונים: A Tensor . חייב להיות אותו סוג כמו ref. טנסור של ערכים מעודכנים להוסיף ל-ref.
מאפיינים אופציונליים (ראה Attrs
):
- use_locking: bool אופציונלי. ברירת המחדל ל-True. אם נכון, ההקצאה תהיה מוגנת במנעול; אחרת ההתנהגות אינה מוגדרת, אך עלולה להפגין פחות מחלוקת.
החזרות:
-
Operation
שנוצר
בנאים והורסים | |
---|---|
ResourceScatterNdUpdate (const :: tensorflow::Scope & scope, :: tensorflow::Input ref, :: tensorflow::Input indices, :: tensorflow::Input updates) | |
ResourceScatterNdUpdate (const :: tensorflow::Scope & scope, :: tensorflow::Input ref, :: tensorflow::Input indices, :: tensorflow::Input updates, const ResourceScatterNdUpdate::Attrs & attrs) |
תפקידים ציבוריים | |
---|---|
operator::tensorflow::Operation () const |
פונקציות סטטיות ציבוריות | |
---|---|
UseLocking (bool x) |
מבנים | |
---|---|
tensorflow:: ops:: ResourceScatterNdUpdate:: Attrs | קובעי תכונות אופציונליים עבור ResourceScatterNdUpdate . |
תכונות ציבוריות
מִבצָע
Operation operation
תפקידים ציבוריים
ResourceScatterNdUpdate
ResourceScatterNdUpdate(
const ::tensorflow::Scope & scope,
::tensorflow::Input ref,
::tensorflow::Input indices,
::tensorflow::Input updates
)
ResourceScatterNdUpdate
ResourceScatterNdUpdate(
const ::tensorflow::Scope & scope,
::tensorflow::Input ref,
::tensorflow::Input indices,
::tensorflow::Input updates,
const ResourceScatterNdUpdate::Attrs & attrs
)
אופרטור::tensorflow::פעולה
operator::tensorflow::Operation() const
פונקציות סטטיות ציבוריות
השתמש בנעילה
Attrs UseLocking(
bool x
)