Skip to content

Commit ce20ee7

Browse files
author
dotchris90
committed
Add : Renamed Order to Layout and Shapes to Dimensions
1 parent 3d1aafc commit ce20ee7

File tree

2 files changed

+10
-23
lines changed

2 files changed

+10
-23
lines changed

src/NumSharp.Core/Interfaces/IShape.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ public interface IShape
88
{
99
int Size {get;}
1010
int NDim {get;}
11-
int TensorOrder {get;}
12-
IReadOnlyList<int> DimOffset {get;}
13-
IReadOnlyList<int> Shapes {get;}
14-
int ReShape(params int[] dimensions);
11+
int TensorLayout {get;}
12+
int[] DimOffset {get;}
13+
int[] Dimensions {get;}
1514
int GetIndexInShape(params int[] select);
1615
int[] GetDimIndexOutShape(int select);
1716
int UniShape {get;}
1817
(int, int) BiShape {get;}
1918
(int, int, int) TriShape {get;}
20-
bool ChangeTensorOrder(int order);
19+
void ChangeTensorLayout(int order);
2120
}
2221
}

src/NumSharp.Core/Interfaces/IStorage.cs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace NumSharp.Core.Interfaces
1818
/// - CloneData<T> clone storage and cast this clone
1919
///
2020
/// </summary>
21-
public interface IStorage
21+
public interface IStorage : ICloneable
2222
{
2323
/// <summary>
2424
/// Data Type of stored elements
@@ -34,14 +34,14 @@ public interface IStorage
3434
/// column wise or row wise order
3535
/// </summary>
3636
/// <value>0 row wise, 1 column wise</value>
37-
int TensorOrder {get;}
37+
int TensorLayout {get;}
3838
/// <summary>
3939
/// Allocate memory by dtype, shape, tensororder (default column wise)
4040
/// </summary>
4141
/// <param name="dtype">storage data type</param>
4242
/// <param name="shape">storage data shape</param>
4343
/// <param name="tensorOrder">row or column wise</param>
44-
void Allocate(Type dtype, Shape shape, int tensorOrder = 1);
44+
void Allocate(Type dtype, IShape shape, int tensorOrder = 1);
4545
/// <summary>
4646
/// Allocate memory by Array and tensororder and deduce shape and dtype (default column wise)
4747
/// </summary>
@@ -119,19 +119,6 @@ public interface IStorage
119119
/// <param name="indexes"></param>
120120
void SetData(object value, params int[] indexes);
121121
/// <summary>
122-
/// Set a 1D Array of type T to internal storage and cast dtype
123-
/// </summary>
124-
/// <param name="values"></param>
125-
/// <typeparam name="T"></typeparam>
126-
void SetData<T>(T[] values);
127-
/// <summary>
128-
/// Set a single value of type dtype to internal storage and cast storage
129-
/// </summary>
130-
/// <param name="value"></param>
131-
/// <param name="indexes"></param>
132-
/// <typeparam name="T"></typeparam>
133-
void SetData<T>(T value, params int[] indexes);
134-
/// <summary>
135122
/// Set an Array to internal storage, cast it to new dtype and change dtype
136123
/// </summary>
137124
/// <param name="values"></param>
@@ -142,12 +129,13 @@ public interface IStorage
142129
/// </summary>
143130
/// <param name="dtype">new storage data type</param>
144131
/// <returns>sucess or not</returns>
145-
bool ChangeDataType(Type dtype);
132+
void ChangeDataType(Type dtype);
146133
/// <summary>
147134
/// Cange layout to 0 row wise or 1 colum wise
148135
/// </summary>
149136
/// <param name="order">0 or 1</param>
150137
/// <returns>success or not</returns>
151-
bool SwitchTensorOrder(int order);
138+
void ChangeTensorLayout(int order);
139+
void Reshape(params int[] dimensions);
152140
}
153141
}

0 commit comments

Comments
 (0)