tensorflow::ops::MatrixBandPart

#include <array_ops.h>

Sao chép một tensor thiết lập mọi thứ bên ngoài dải trung tâm trong mỗi ma trận trong cùng.

Bản tóm tắt

về không.

Phần band được tính toán như sau: Giả sử input có k chiều [I, J, K, ..., M, N] , thì đầu ra là một tensor có cùng hình dạng trong đó

band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n] .

Chức năng chỉ báo

in_band(m, n) = (num_lower < 0 || (mn) <= num_lower)) && (num_upper < 0 || (nm) <= num_upper) .

Ví dụ:

# 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]]

Các trường hợp đặc biệt hữu ích:

 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.

Luận điểm:

  • phạm vi: Một đối tượng Phạm vi
  • Đầu vào: Tensor hạng k .
  • num_lower: Tensor 0 chiều. Số lượng đường chéo con cần giữ lại. Nếu âm, giữ lại toàn bộ tam giác dưới.
  • num_upper: Tensor 0 chiều. Số lượng đường chéo trên cần giữ lại. Nếu âm, giữ lại toàn bộ tam giác trên.

Trả về:

  • Output : Tensor bậc k có cùng hình dạng với tensor đầu vào. Tensor dải được trích xuất.

Hàm khởi tạo và hàm hủy

MatrixBandPart (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input num_lower, :: tensorflow::Input num_upper)

Thuộc tính công khai

band
operation

Chức năng công cộng

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

Thuộc tính công khai

ban nhạc

::tensorflow::Output band

hoạt động

Operation operation

Chức năng công cộng

MatrixBandPart

 MatrixBandPart(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input num_lower,
  ::tensorflow::Input num_upper
)

nút

::tensorflow::Node * node() const 

operator::tensorflow::Input

 operator::tensorflow::Input() const 

operator::tensorflow::Output

 operator::tensorflow::Output() const