tensorflow::ops::MatrixBandPart
#include <array_ops.h>คัดลอกค่าเทนเซอร์ที่กำหนดค่าทุกอย่างที่อยู่นอกแถบตรงกลางในแต่ละเมทริกซ์ชั้นในสุด
สรุป
ให้เป็นศูนย์
ส่วนของ band คำนวณได้ดังนี้: สมมติว่า input มี k มิติ [I, J, K, ..., M, N] แล้วเอาต์พุตจะเป็นเทนเซอร์ที่มีรูปร่างเดียวกัน โดยที่
band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n] .
ฟังก์ชันตัวบ่งชี้
in_band(m, n) = (num_lower < 0 || (mn) <= num_lower)) && (num_upper < 0 || (nm) <= num_upper) .
ตัวอย่างเช่น:
# if 'input' is [[ 0, 1, 2, 3]
[-1, 0, 1, 2]
[-2, -1, 0, 1]
[-3, -2, -1, 0]],tf.matrix_band_part(input, 1, -1) ==> [[ 0, 1, 2, 3]
[-1, 0, 1, 2]
[ 0, -1, 0, 1]
[ 0, 0, -1, 0]],tf.matrix_band_part(input, 2, 1) ==> [[ 0, 1, 0, 0]
[-1, 0, 1, 0]
[-2, -1, 0, 1]
[ 0, -2, -1, 0]]กรณีพิเศษที่มีประโยชน์:
tf.matrix_band_part(input, 0, -1) ==> Upper triangular part. tf.matrix_band_part(input, -1, 0) ==> Lower triangular part. tf.matrix_band_part(input, 0, 0) ==> Diagonal.
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- อินพุต: เทนเซอร์อันดับ
k - num_lower: เทนเซอร์ 0 มิติ จำนวนเส้นทแยงมุมย่อยที่จะเก็บไว้ หากเป็นค่าลบ ให้เก็บสามเหลี่ยมล่างทั้งหมด
- num_upper: เทนเซอร์ 0 มิติ จำนวนซูเปอร์ไดอะโกนัลที่จะเก็บไว้ หากเป็นค่าลบ ให้เก็บสามเหลี่ยมด้านบนทั้งหมด
การส่งคืนสินค้า:
-
Output: เทนเซอร์อันดับkที่มีรูปร่างเหมือนกับอินพุต เทนเซอร์แบบแถบที่แยกออกมา
ตัวสร้างและตัวทำลาย | |
|---|---|
MatrixBandPart (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input num_lower, :: tensorflow::Input num_upper) |
คุณลักษณะสาธารณะ | |
|---|---|
band | |
operation | |
หน้าที่สาธารณะ | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
คุณลักษณะสาธารณะ
วงดนตรี
::tensorflow::Output band
การดำเนินการ
Operation operation
หน้าที่สาธารณะ
เมทริกซ์แบนด์พาร์ท
MatrixBandPart( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input num_lower, ::tensorflow::Input num_upper )
โหนด
::tensorflow::Node * node() const
ตัวดำเนินการ::เทนเซอร์โฟลว์::อินพุต
operator::tensorflow::Input() const
ตัวดำเนินการ::เทนเซอร์โฟลว์::เอาต์พุต
operator::tensorflow::Output() const