tensorflow:: אופס:: ScatterNdAdd

#include <state_ops.h>

מחיל תוספת דלילה על ערכים בודדים או פרוסות במשתנה .

סיכום

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])
add = tf.scatter_nd_add(ref, indices, updates)
with tf.Session() as sess:
  print sess.run(add)

העדכון שיתקבל ל-ref ייראה כך:

[1, 13, 3, 14, 14, 6, 7, 20]

ראה tf.scatter_nd לפרטים נוספים על איך לבצע עדכונים לפרוסות.

טיעונים:

  • scope: אובייקט Scope
  • ref: Tensor ניתן לשינוי. צריך להיות מצומת משתנה .
  • מדדים: A Tensor . חייב להיות אחד מהסוגים הבאים: int32, int64. טנזור של מדדים לתוך ref.
  • עדכונים: A Tensor . חייב להיות אותו סוג כמו ref. טנסור של ערכים מעודכנים להוסיף ל-ref.

מאפיינים אופציונליים (ראה Attrs ):

  • use_locking: bool אופציונלי. ברירת המחדל ל-True. אם נכון, ההקצאה תהיה מוגנת במנעול; אחרת ההתנהגות אינה מוגדרת, אך עלולה להפגין פחות מחלוקת.

החזרות:

  • Output : זהה ל-ref. הוחזר כנוחות עבור פעולות שרוצות להשתמש בערכים המעודכנים לאחר ביצוע העדכון.

בנאים והורסים

ScatterNdAdd (const :: tensorflow::Scope & scope, :: tensorflow::Input ref, :: tensorflow::Input indices, :: tensorflow::Input updates)
ScatterNdAdd (const :: tensorflow::Scope & scope, :: tensorflow::Input ref, :: tensorflow::Input indices, :: tensorflow::Input updates, const ScatterNdAdd::Attrs & attrs)

תכונות ציבוריות

operation
output_ref

תפקידים ציבוריים

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

פונקציות סטטיות ציבוריות

UseLocking (bool x)

מבנים

tensorflow:: ops:: ScatterNdAdd:: Attrs

קובעי תכונות אופציונליים עבור ScatterNdAdd .

תכונות ציבוריות

מבצע

Operation operation

פלט_ref

::tensorflow::Output output_ref

תפקידים ציבוריים

ScatterNdAdd

 ScatterNdAdd(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input ref,
  ::tensorflow::Input indices,
  ::tensorflow::Input updates
)

ScatterNdAdd

 ScatterNdAdd(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input ref,
  ::tensorflow::Input indices,
  ::tensorflow::Input updates,
  const ScatterNdAdd::Attrs & attrs
)

צוֹמֶת

::tensorflow::Node * node() const 

מפעיל::tensorflow::קלט

 operator::tensorflow::Input() const 

אופרטור::tensorflow::פלט

 operator::tensorflow::Output() const 

פונקציות סטטיות ציבוריות

השתמש בנעילה

Attrs UseLocking(
  bool x
)