เทนเซอร์โฟลว์:: ปฏิบัติการ:: คัมซัม

#include <math_ops.h>

คำนวณผลรวมสะสมของเทนเซอร์ x ตาม axis

สรุป

ตามค่าเริ่มต้น op นี้จะดำเนินการรวม cumsum ซึ่งหมายความว่าองค์ประกอบแรกของอินพุตจะเหมือนกับองค์ประกอบแรกของเอาต์พุต:

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]

โดยการตั้งค่า kwarg 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 พิเศษเฉพาะ
  • ย้อนกลับ: bool (ค่าเริ่มต้น: เท็จ)

ผลตอบแทน:

  • 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)

โครงสร้าง

เทนเซอร์โฟลว์ :: 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 

ตัวดำเนินการ::tensorflow::อินพุต

 operator::tensorflow::Input() const 

ตัวดำเนินการ::tensorflow::เอาต์พุต

 operator::tensorflow::Output() const 

ฟังก์ชันคงที่สาธารณะ

พิเศษ

Attrs Exclusive(
  bool x
)

ย้อนกลับ

Attrs Reverse(
  bool x
)