MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / nth_element

Function nth_element

tensorflow/python/ops/nn_ops.py:4449–4476  ·  view source on GitHub ↗

r"""Finds values of the `n`-th smallest value for the last dimension. Note that n is zero-indexed. 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

(input, n, reverse=False, name=None)

Source from the content-addressed store, hash-verified

4447
4448
4449def nth_element(input, n, reverse=False, name=None): # pylint: disable=redefined-builtin
4450 r"""Finds values of the `n`-th smallest value for the last dimension.
4451
4452 Note that n is zero-indexed.
4453
4454 If the input is a vector (rank-1), finds the entries which is the nth-smallest
4455 value in the vector and outputs their values as scalar tensor.
4456
4457 For matrices (resp. higher rank input), computes the entries which is the
4458 nth-smallest value in each row (resp. vector along the last dimension). Thus,
4459
4460 values.shape = input.shape[:-1]
4461
4462 Args:
4463 input: 1-D or higher `Tensor` with last dimension at least `n+1`.
4464 n: A `Tensor` of type `int32`.
4465 0-D. Position of sorted vector to select along the last dimension (along
4466 each row for matrices). Valid range of n is `[0, input.shape[:-1])`
4467 reverse: An optional `bool`. Defaults to `False`.
4468 When set to True, find the nth-largest value in the vector and vice
4469 versa.
4470 name: A name for the operation (optional).
4471
4472 Returns:
4473 A `Tensor`. Has the same type as `input`.
4474 The `n`-th order statistic along each last dimensional slice.
4475 """
4476 return gen_nn_ops.nth_element(input, n, reverse=reverse, name=name)
4477
4478
4479@tf_export(v1=["nn.fractional_max_pool"])

Callers 3

MedianFunction · 0.85
operator()Method · 0.85
SuppressInfrequentMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected