เทนเซอร์โฟลว์:: ออปส์:: คัมซัม
#include <math_ops.h> คำนวณผลรวมสะสมของเทนเซอร์ x ตาม axis y
สรุป
โดยค่าเริ่มต้น การดำเนินการนี้จะทำการคำนวณผลรวมสะสมแบบรวม ซึ่งหมายความว่าองค์ประกอบแรกของข้อมูลนำเข้าจะเหมือนกับองค์ประกอบแรกของข้อมูลส่งออก:
tf.cumsum([a, b, c]) # => [a, a + b, a + b + c]
โดยการตั้งค่า kwarg exclusive เป็น True จะทำการคำนวณ cumsum แบบพิเศษแทน:
tf.cumsum([a, b, c], exclusive=True) # => [0, a, a + b]
โดยการตั้งค่าพารามิเตอร์ reverse เป็น True การคำนวณ cumsum จะดำเนินการในทิศทางตรงกันข้าม:
tf.cumsum([a, b, c], reverse=True) # => [a + b + c, b + c, c]
วิธีนี้มีประสิทธิภาพมากกว่าการใช้ tf.reverse ops แยกต่างหาก
สัญลักษณ์ kwargs reverse และ exclusive สามารถใช้ร่วมกันได้เช่นกัน:
tf.cumsum([a, b, c], exclusive=True, reverse=True) # => [b + c, c, 0]
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- x:
Tensorต้องเป็นหนึ่งในประเภทต่อไปนี้:float32,float64,int64,int32,uint8,uint16,int16,int8,complex64,complex128,qint8,quint8,qint32,half - แกน:
Tensorชนิดint32(ค่าเริ่มต้น: 0) ต้องอยู่ในช่วง[-rank(x), rank(x))
คุณลักษณะเสริม (ดูที่ Attrs ):
- เฉพาะ: ถ้า
Trueให้ทำการคำนวณ cumsum แบบพิเศษ - reverse:
bool(ค่าเริ่มต้น: False)
การส่งคืนสินค้า:
-
Output: เทนเซอร์เอาต์พุต
ตัวสร้างและตัวทำลาย | |
|---|---|
Cumsum (const :: tensorflow::Scope & scope, :: tensorflow::Input x, :: tensorflow::Input axis) | |
Cumsum (const :: tensorflow::Scope & scope, :: tensorflow::Input x, :: tensorflow::Input axis, const Cumsum::Attrs & attrs) |
คุณลักษณะสาธารณะ | |
|---|---|
operation | |
out | |
หน้าที่สาธารณะ | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
ฟังก์ชันคงที่สาธารณะ | |
|---|---|
Exclusive (bool x) | |
Reverse (bool x) | |
โครงสร้าง | |
|---|---|
| tensorflow:: ops:: Cumsum:: Attrs | ตัวเลือกในการตั้งค่าแอตทริบิวต์สำหรับ Cumsum ( ไม่จำเป็น) |
คุณลักษณะสาธารณะ
การดำเนินการ
Operation operation
ออก
::tensorflow::Output out
หน้าที่สาธารณะ
คัมซัม
Cumsum( const ::tensorflow::Scope & scope, ::tensorflow::Input x, ::tensorflow::Input axis )
คัมซัม
Cumsum( const ::tensorflow::Scope & scope, ::tensorflow::Input x, ::tensorflow::Input axis, const Cumsum::Attrs & attrs )
โหนด
::tensorflow::Node * node() const
ตัวดำเนินการ::เทนเซอร์โฟลว์::อินพุต
operator::tensorflow::Input() const
ตัวดำเนินการ::เทนเซอร์โฟลว์::เอาต์พุต
operator::tensorflow::Output() const
ฟังก์ชันคงที่สาธารณะ
พิเศษ
Attrs Exclusive( bool x )
ย้อนกลับ
Attrs Reverse( bool x )