#include <array_ops.h>
Returns a diagonal tensor with a given diagonal values.
Given a diagonal, this operation returns a tensor with the diagonal and everything else padded with zeros. The diagonal is computed as follows:
Assume diagonal has 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:
Returns:
Output: The output tensor. | Constructors and Destructors | |
|---|---|
Diag(const ::tensorflow::Scope & scope, ::tensorflow::Input diagonal) |
| Public attributes | |
|---|---|
output | |
| Public functions | |
|---|---|
node() const | ::tensorflow::Node * |
operator::tensorflow::Input() const | |
operator::tensorflow::Output() const | |
::tensorflow::Output output
Diag( const ::tensorflow::Scope & scope, ::tensorflow::Input diagonal )
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Output() const
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/diag.html