W3cubDocs

/TensorFlow C++

tensorflow::ops::DiagPart

#include <array_ops.h>

Returns the diagonal part of the tensor.

Summary

This operation returns a tensor with the diagonal part of the input. The diagonal part is computed as follows:

Assume input has dimensions [D1,..., Dk, D1,..., Dk], then the output is a tensor of rank k with dimensions [D1,..., Dk] where:

diagonal[i1,..., ik] = input[i1, ..., ik, i1,..., ik].

For example:

```prettyprint 'input' is [[1, 0, 0, 0]

[0, 2, 0, 0] [0, 0, 3, 0] [0, 0, 0, 4]]

tf.diag_part(input) ==> [1, 2, 3, 4] ```

Arguments:

  • scope: A Scope object
  • input: Rank k tensor where k is 2, 4, or 6.

Returns:

  • Output: The extracted diagonal.
Constructors and Destructors
DiagPart(const ::tensorflow::Scope & scope, ::tensorflow::Input input)
Public attributes
diagonal
Public functions
node() const
::tensorflow::Node *
operator::tensorflow::Input() const
operator::tensorflow::Output() const

Public attributes

diagonal

::tensorflow::Output diagonal

Public functions

DiagPart

 DiagPart(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input
)

node

::tensorflow::Node * node() const 

operator::tensorflow::Input

operator::tensorflow::Input() const 

operator::tensorflow::Output

operator::tensorflow::Output() const 

© 2017 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-part.html