เทนเซอร์โฟลว์:: ปฏิบัติการ:: เมทริกซ์แบนด์พาร์ท
#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-D จำนวนเส้นทแยงมุมย่อยที่จะเก็บ หากเป็นลบ ให้คงรูปสามเหลี่ยมด้านล่างไว้ทั้งหมด
- num_upper: เทนเซอร์ 0-D จำนวนเส้นทแยงมุมเหนือที่จะเก็บ หากเป็นลบ ให้คงรูปสามเหลี่ยมด้านบนไว้ทั้งหมด
ผลตอบแทน:
-
Output: Rankkเทนเซอร์ที่มีรูปร่างเดียวกันกับอินพุต เทนเซอร์แถบสีที่แยกออกมา
ตัวสร้างและผู้ทำลาย | |
|---|---|
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
ตัวดำเนินการ::tensorflow::อินพุต
operator::tensorflow::Input() const
ตัวดำเนินการ::tensorflow::เอาต์พุต
operator::tensorflow::Output() const