Diag


tensorflow C++ API

tensorflow::ops::Diag

Returns a diagonal tensor with a given diagonal values.


Summary

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

Assumediagonalhas dimensions [D1,..., Dk], then the output is a tensor of rank 2k with dimensions [D1,..., Dk, D1,..., Dk] where:

output[i1,..., ik, i1,..., ik] = diagonal[i1, ..., ik]and 0 everywhere else.

For example:

``` 'diagonal' is [1, 2, 3, 4]

tf.diag(diagonal) ==> [[1, 0, 0, 0] [0, 2, 0, 0] [0, 0, 3, 0] [0, 0, 0, 4]] ```

Arguments:

  • scope: A Scope object
  • diagonal: Rank k tensor where k is at most 3.

Returns:


Diag 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 Tensor. Must be one of the following types: float32, float64, int32, int64, complex64, complex128. Rank k tensor where k is at most 3.

Return:

  • Output output : Output object of Diag class object.

Result:

  • std::vector(Tensor) result_output : Assumediagonalhas dimensions [D1,..., Dk], then the output is a tensor of rank 2k with dimensions [D1,..., Dk, D1,..., Dk] where: output[i1,..., ik, i1,..., ik] = diagonal[i1, ..., ik]and 0 everywhere else.

Using Method

※ Rank를 늘려주는 역할을 한다.

results matching ""

    No results matching ""