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

Function sort

tensorflow/python/ops/sort_ops.py:37–66  ·  view source on GitHub ↗

Sorts a tensor. Usage: ```python import tensorflow as tf a = [1, 10, 26.9, 2.8, 166.32, 62.3] b = tf.sort(a,axis=-1,direction='ASCENDING',name=None) c = tf.keras.backend.eval(b) # Here, c = [ 1. 2.8 10. 26.9 62.3 166.32] ``` Args: values: 1-D or higher numer

(values, axis=-1, direction='ASCENDING', name=None)

Source from the content-addressed store, hash-verified

35
36@tf_export('sort')
37def sort(values, axis=-1, direction='ASCENDING', name=None):
38 """Sorts a tensor.
39
40 Usage:
41
42 ```python
43 import tensorflow as tf
44 a = [1, 10, 26.9, 2.8, 166.32, 62.3]
45 b = tf.sort(a,axis=-1,direction='ASCENDING',name=None)
46 c = tf.keras.backend.eval(b)
47 # Here, c = [ 1. 2.8 10. 26.9 62.3 166.32]
48 ```
49
50 Args:
51 values: 1-D or higher numeric `Tensor`.
52 axis: The axis along which to sort. The default is -1, which sorts the last
53 axis.
54 direction: The direction in which to sort the values (`'ASCENDING'` or
55 `'DESCENDING'`).
56 name: Optional name for the operation.
57
58 Returns:
59 A `Tensor` with the same dtype and shape as `values`, with the elements
60 sorted along the given `axis`.
61
62 Raises:
63 ValueError: If axis is not a constant scalar, or the direction is invalid.
64 """
65 with framework_ops.name_scope(name, 'sort'):
66 return _sort_or_argsort(values, axis, direction, return_argsort=False)
67
68
69@tf_export('argsort')

Callers 15

HashNodeDefFunction · 0.85
SummarizeGraphFunction · 0.85
FoldConstantsFunction · 0.85
MaybeAddUsedHandlerMethod · 0.85
DropOutTreesMethod · 0.85
GenerateEntryListMethod · 0.85
SetupProbingMethod · 0.85
GetTopLabelsFunction · 0.85
GetTopLabelsFunction · 0.85

Calls 2

_sort_or_argsortFunction · 0.85
name_scopeMethod · 0.45

Tested by 15

TESTFunction · 0.68
MedianFunction · 0.68
MedianAbsFunction · 0.68
CheckOutputDataFunction · 0.68
CompareRoundingResultsFunction · 0.68
CheckOutputDataFunction · 0.68
GetMatrixStatsFunction · 0.68
MakeSpecClampFieldsFunction · 0.68
OpQuantSpecWriterFunction · 0.68
GraphNodesFunction · 0.68
GraphEdgesFunction · 0.68