@@ -77,25 +77,25 @@ public bool IsRecursive
77
77
/// <summary>
78
78
/// Singleton instance of a <see cref="Shape"/> that represents a scalar.
79
79
/// </summary>
80
- public static readonly Shape Scalar = new Shape ( Array . Empty < int > ( ) ) ;
80
+ public static readonly Shape Scalar = new Shape ( new int [ 0 ] ) ;
81
81
82
82
/// <summary>
83
83
/// Create a new scalar shape
84
84
/// </summary>
85
85
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
86
- internal static Shape NewScalar ( ) => new Shape ( Array . Empty < int > ( ) ) ;
86
+ internal static Shape NewScalar ( ) => new Shape ( new int [ 0 ] ) ;
87
87
88
88
/// <summary>
89
89
/// Create a new scalar shape
90
90
/// </summary>
91
91
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
92
- internal static Shape NewScalar ( ViewInfo viewInfo ) => new Shape ( Array . Empty < int > ( ) ) { ViewInfo = viewInfo } ;
92
+ internal static Shape NewScalar ( ViewInfo viewInfo ) => new Shape ( new int [ 0 ] ) { ViewInfo = viewInfo } ;
93
93
94
94
/// <summary>
95
95
/// Create a new scalar shape
96
96
/// </summary>
97
97
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
98
- internal static Shape NewScalar ( ViewInfo viewInfo , BroadcastInfo broadcastInfo ) => new Shape ( Array . Empty < int > ( ) ) { ViewInfo = viewInfo , BroadcastInfo = broadcastInfo } ;
98
+ internal static Shape NewScalar ( ViewInfo viewInfo , BroadcastInfo broadcastInfo ) => new Shape ( new int [ 0 ] ) { ViewInfo = viewInfo , BroadcastInfo = broadcastInfo } ;
99
99
100
100
/// <summary>
101
101
/// Create a shape that represents a vector.
@@ -278,7 +278,7 @@ public Shape(params int[] dims)
278
278
{
279
279
if ( dims == null )
280
280
{
281
- strides = dims = dimensions = Array . Empty < int > ( ) ;
281
+ strides = dims = dimensions = new int [ 0 ] ;
282
282
}
283
283
else
284
284
{
@@ -977,7 +977,7 @@ public static int[] GetAxis(int[] dims, int axis)
977
977
throw new ArgumentNullException ( nameof ( dims ) ) ;
978
978
979
979
if ( dims . Length == 0 )
980
- return Array . Empty < int > ( ) ;
980
+ return new int [ 0 ] ;
981
981
982
982
if ( axis <= - 1 ) axis = dims . Length - 1 ;
983
983
if ( axis >= dims . Length )
@@ -1116,7 +1116,7 @@ public Shape Slice(params Slice[] input_slices)
1116
1116
public static explicit operator int ( Shape shape ) => shape . Size ;
1117
1117
public static explicit operator Shape ( int dim ) => Shape . Vector ( dim ) ;
1118
1118
1119
- public static explicit operator ( int , int ) ( Shape shape ) => shape . dimensions . Length == 2 ? ( shape . dimensions [ 0 ] , shape . dimensions [ 1 ] ) : ( 0 , 0 ) ; //TODO! this should return (0,0) but rather (dim[0], dim[1]) regardless of size.
1119
+ public static explicit operator ( int , int ) ( Shape shape ) => shape . dimensions . Length == 2 ? ( shape . dimensions [ 0 ] , shape . dimensions [ 1 ] ) : ( 0 , 0 ) ;
1120
1120
public static implicit operator Shape ( ( int , int ) dims ) => Shape . Matrix ( dims . Item1 , dims . Item2 ) ;
1121
1121
1122
1122
public static explicit operator ( int , int , int ) ( Shape shape ) => shape . dimensions . Length == 3 ? ( shape . dimensions [ 0 ] , shape . dimensions [ 1 ] , shape . dimensions [ 2 ] ) : ( 0 , 0 , 0 ) ;
0 commit comments