tensorflow:: אופס:: ExpandDims

#include <array_ops.h>

מכניס ממד של 1 לצורת טנזור.

סיכום

בהינתן קלט input , פעולה זו מכניסה ממד של 1 axis אינדקס הממד של צורת input . axis אינדקס הממד מתחיל באפס; אם אתה מציין מספר שלילי עבור axis הוא נספר לאחור מהסוף.

פעולה זו שימושית אם ברצונך להוסיף ממד אצווה לרכיב בודד. לדוגמה, אם יש לך תמונה אחת של צורה [height, width, channels] , אתה יכול להפוך אותה לקבוצה של תמונה אחת עם expand_dims(image, 0) , מה שיהפוך את הצורה [1, height, width, channels] .

דוגמאות נוספות:

# 't' is a tensor of shape [2]
shape(expand_dims(t, 0)) ==> [1, 2]
shape(expand_dims(t, 1)) ==> [2, 1]
shape(expand_dims(t, -1)) ==> [2, 1]

# 't2' is a tensor of shape [2, 3, 5]
shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5]
shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5]
shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1]

פעולה זו דורשת כי:

-1-input.dims() <= dim <= input.dims()

פעולה זו קשורה ל- squeeze() , אשר מסירה ממדים בגודל 1.

טיעונים:

  • scope: אובייקט Scope
  • ציר: 0-D (סקלר). מציין את אינדקס הממדים שבו יש להרחיב את צורת input . חייב להיות בטווח [-rank(input) - 1, rank(input)] .

החזרות:

  • Output : מכיל את אותם נתונים כמו input , אך לצורתו נוסף ממד נוסף בגודל 1.

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

ExpandDims (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input axis)

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

operation
output

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

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

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

מבצע

Operation operation

תְפוּקָה

::tensorflow::Output output

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

ExpandDims

 ExpandDims(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input axis
)

צוֹמֶת

::tensorflow::Node * node() const 

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

 operator::tensorflow::Input() const 

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

 operator::tensorflow::Output() const