# tensorflow::ops::NthElement Class Reference

# tensorflow::ops::NthElement

`#include <nn_ops.h>`

Finds values of the `n`-th order statistic for the last dimension.

## Summary

If the input is a vector (rank-1), finds the entries which is the nth-smallest value in the vector and outputs their values as scalar tensor.

For matrices (resp. higher rank input), computes the entries which is the nth-smallest value in each row (resp. vector along the last dimension). Thus,

```
values.shape = input.shape[:-1]
```

<br />

Arguments:

- scope: A [Scope](https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- input: 1-D or higher with last dimension at least `n+1`.
- n: 0-D. Position of sorted vector to select along the last dimension (along each row for matrices). Valid range of n is `[0, input.shape[:-1])`

<br />

Optional attributes (see `https://www.tensorflow.org/versions/r2.3/api_docs/cc/struct/tensorflow/ops/nth-element/attrs#structtensorflow_1_1ops_1_1_nth_element_1_1_attrs`):

- reverse: When set to True, find the nth-largest value in the vector and vice versa.

<br />

Returns:

- `https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output`: The `n`-th order statistic along each last dimensional slice.

<br />

| ### Constructors and Destructors ||
|---|---|
| `https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/ops/nth-element#classtensorflow_1_1ops_1_1_nth_element_1ad57d32106099de0a7c5cd0e118f56250(const ::https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, ::https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input input, ::https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input n)` ||
| `https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/ops/nth-element#classtensorflow_1_1ops_1_1_nth_element_1a2c84dbdc0bb358d13e010718142e8462(const ::https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, ::https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input input, ::https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input n, const https://www.tensorflow.org/versions/r2.3/api_docs/cc/struct/tensorflow/ops/nth-element/attrs#structtensorflow_1_1ops_1_1_nth_element_1_1_attrs & attrs)` ||

| ### Public attributes ||
|---|---|
| `https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/ops/nth-element#classtensorflow_1_1ops_1_1_nth_element_1a41b2c3dfd7a0fa9341473a14fab18494` | `https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation` |
| `https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/ops/nth-element#classtensorflow_1_1ops_1_1_nth_element_1a2b48d7270f25613807700819eff1cb49` | `::https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` |

| ### Public functions ||
|---|---|
| `https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/ops/nth-element#classtensorflow_1_1ops_1_1_nth_element_1a3f9b0440c04a7d951228451e291f008b() const ` | `::tensorflow::Node *` |
| `https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/ops/nth-element#classtensorflow_1_1ops_1_1_nth_element_1a9c60d391af60a8d7c268aacbf8a7093b() const ` | ` `` ` |
| `https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/ops/nth-element#classtensorflow_1_1ops_1_1_nth_element_1ab7ba43882ec3623ce6d7c9bd9e2b47ba() const ` | ` `` ` |

| ### Public static functions ||
|---|---|
| `https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/ops/nth-element#classtensorflow_1_1ops_1_1_nth_element_1ad86f92398afd7420e3f6db7643954291(bool x)` | `https://www.tensorflow.org/versions/r2.3/api_docs/cc/struct/tensorflow/ops/nth-element/attrs#structtensorflow_1_1ops_1_1_nth_element_1_1_attrs` |

| ### Structs ||
|---|---|
| [tensorflow::ops::NthElement::Attrs](https://www.tensorflow.org/versions/r2.3/api_docs/cc/struct/tensorflow/ops/nth-element/attrs) | Optional attribute setters for [NthElement](https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/ops/nth-element#classtensorflow_1_1ops_1_1_nth_element). |

## Public attributes

### operation

```
Operation operation
```

### values

```
::tensorflow::Output values
```

## Public functions

### NthElement

```
 NthElement(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input n
)
```

### NthElement

```
 NthElement(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input n,
  const NthElement::Attrs & attrs
)
```

### node

```
::tensorflow::Node * node() const 
```

### operator::tensorflow::Input

```
 operator::tensorflow::Input() const 
```

### operator::tensorflow::Output

```
 operator::tensorflow::Output() const 
```

## Public static functions

### Reverse

```
Attrs Reverse(
  bool x
)
```