11using System ;
22using System . Collections ;
33using System . Collections . Generic ;
4+ using System . Globalization ;
45using System . Numerics ;
56using System . Text ;
67
@@ -9,11 +10,11 @@ namespace Tensorflow.NumPy
910 public partial class np
1011 {
1112 [ AutoNumPy ]
12- public static NDArray argmax ( NDArray a , Axis axis = null )
13+ public static NDArray argmax ( NDArray a , Axis ? axis = null )
1314 => new NDArray ( math_ops . argmax ( a , axis ?? 0 ) ) ;
1415
1516 [ AutoNumPy ]
16- public static NDArray argsort ( NDArray a , Axis axis = null )
17+ public static NDArray argsort ( NDArray a , Axis ? axis = null )
1718 => new NDArray ( sort_ops . argsort ( a , axis : axis ?? - 1 ) ) ;
1819
1920 [ AutoNumPy ]
@@ -25,5 +26,22 @@ public static (NDArray, NDArray) unique(NDArray a)
2526
2627 [ AutoNumPy ]
2728 public static void shuffle ( NDArray x ) => np . random . shuffle ( x ) ;
29+
30+ /// <summary>
31+ /// Sorts a ndarray
32+ /// </summary>
33+ /// <param name="values"></param>
34+ /// <param name="axis">
35+ /// The axis along which to sort. The default is -1, which sorts the last axis.
36+ /// </param>
37+ /// <param name="direction">
38+ /// The direction in which to sort the values (`'ASCENDING'` or `'DESCENDING'`)
39+ /// </param>
40+ /// <returns>
41+ /// A `NDArray` with the same dtype and shape as `values`, with the elements sorted along the given `axis`.
42+ /// </returns>
43+ [ AutoNumPy ]
44+ public static NDArray sort ( NDArray values , Axis ? axis = null , string direction = "ASCENDING" )
45+ => new NDArray ( sort_ops . sort ( values , axis : axis ?? - 1 , direction : direction ) ) ;
2846 }
2947}
0 commit comments