MatrixDiag


tensorflow C++ API

tensorflow::ops::MatrixDiag

Returns a batched diagonal tensor with a given batched diagonal values.


Summary

Given adiagonal, this operation returns a tensor with thediagonaland everything else padded with zeros. The diagonal is computed as follows:

Assumediagonalhaskdimensions[I, J, K, ..., N], then the output is a tensor of rankk+1with dimensions [I, J, K, ..., N, N]` where:

output[i, j, k, ..., m, n] = 1{m=n} * diagonal[i, j, k, ..., n].

For example:

``` 'diagonal' is [[1, 2, 3, 4], [5, 6, 7, 8]]

and diagonal.shape = (2, 4)

tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0] [0, 2, 0, 0] [0, 0, 3, 0] [0, 0, 0, 4]], [[5, 0, 0, 0] [0, 6, 0, 0] [0, 0, 7, 0] [0, 0, 0, 8]]]

which has shape (2, 4, 4) ```

Arguments:

  • scope: A Scope object
  • diagonal: Rank k, where k >= 1.

Returns:

  • Output: Rank k+1, with output.shape = diagonal.shape + [diagonal.shape[-1]].

MatrixDiag block

Source link :https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_array_ops.cpp

Argument:

  • Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
  • Input diagonal : A 1-D Tensor type of int32,int64(Must be one integer type).

Output:

  • Output output : Output object of MatrixBandPart class object.

Result:

  • std::vector(Tensor) result_output: A Tensor.

Using Method

※ tensorflow 1.3 does not support Windows

results matching ""

    No results matching ""