forked from SciSharp/NumSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTensorEngine.cs
More file actions
123 lines (95 loc) · 6.17 KB
/
TensorEngine.cs
File metadata and controls
123 lines (95 loc) · 6.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using System;
using NumSharp.Backends;
using NumSharp.Backends.Unmanaged;
using NumSharp.Generic;
namespace NumSharp
{
public abstract class TensorEngine
{
#region Allocation
/// <summary>
/// Get storage for given <paramref name="dtype"/>.
/// </summary>
public abstract UnmanagedStorage GetStorage(Type dtype);
/// <summary>
/// Get storage for given <paramref name="typeCode"/>.
/// </summary>
public abstract UnmanagedStorage GetStorage(NPTypeCode typeCode);
#endregion
#region Math
#region Reduction
public abstract NDArray ReduceAdd(in NDArray arr, int? axis_, bool keepdims = false, NPTypeCode? typeCode = null, NDArray @out = null);
public abstract NDArray ReduceCumAdd(in NDArray arr, int? axis_, NPTypeCode? typeCode = null);
public abstract NDArray ReduceMean(in NDArray arr, int? axis_, bool keepdims = false, NPTypeCode? typeCode = null);
#endregion
public abstract NDArray Add(in NDArray lhs, in NDArray rhs);
public abstract NDArray Dot(in NDArray x, in NDArray y);
public abstract NDArray Divide(in NDArray lhs, in NDArray rhs);
public abstract NDArray Matmul(NDArray lhs, NDArray rhs);
public abstract NDArray Mean(in NDArray nd, int? axis = null, NPTypeCode? typeCode = null, bool keepdims = false);
public abstract NDArray Mean(in NDArray nd, int axis, Type dtype, bool keepdims = false);
public abstract NDArray Multiply(NDArray lhs, NDArray rhs);
public abstract NDArray Power(in NDArray lhs, in ValueType rhs, Type type);
public abstract NDArray Power(in NDArray lhs, in ValueType rhs, NPTypeCode? typeCode = null);
public abstract NDArray Subtract(in NDArray lhs, in NDArray rhs);
public abstract NDArray Sum(in NDArray nd, int? axis = null, NPTypeCode? typeCode = null, bool keepdims = false);
public abstract NDArray Sum(in NDArray nd, int axis, Type dtype, bool keepdims = false);
public abstract NDArray Negate(in NDArray nd);
public abstract NDArray Abs(in NDArray nd, Type dtype);
public abstract NDArray Abs(in NDArray nd, NPTypeCode? typeCode = null);
public abstract NDArray Sqrt(in NDArray nd, Type dtype);
public abstract NDArray Sqrt(in NDArray nd, NPTypeCode? typeCode = null);
public abstract NDArray Log(in NDArray nd, Type dtype);
public abstract NDArray Log(in NDArray nd, NPTypeCode? typeCode = null);
public abstract NDArray Exp(in NDArray nd, Type dtype);
public abstract NDArray Exp(in NDArray nd, NPTypeCode? typeCode = null);
public abstract NDArray Tan(in NDArray nd, Type dtype);
public abstract NDArray Tan(in NDArray nd, NPTypeCode? typeCod = null);
public abstract NDArray Sin(in NDArray nd, Type dtype);
public abstract NDArray Sin(in NDArray nd, NPTypeCode? typeCode = null);
public abstract NDArray Cos(in NDArray nd, Type dtype);
public abstract NDArray Cos(in NDArray nd, NPTypeCode? typeCode = null);
public abstract NDArray Tanh(in NDArray nd, Type dtype);
public abstract NDArray Tanh(in NDArray nd, NPTypeCode? typeCode = null);
public abstract NDArray Cosh(in NDArray nd, Type dtype);
public abstract NDArray Cosh(in NDArray nd, NPTypeCode? typeCode = null);
public abstract NDArray Sinh(in NDArray nd, Type dtype);
public abstract NDArray Sinh(in NDArray nd, NPTypeCode? typeCode = null);
#endregion
#region Logic
public abstract NDArray<bool> Compare(in NDArray lhs, in NDArray rhs);
public abstract bool All(NDArray nd);
public abstract NDArray<bool> All(NDArray nd, int axis);
public abstract bool AllClose(NDArray a, NDArray b, double rtol = 1.0E-5, double atol = 1.0E-8, bool equal_nan = false);
public abstract NDArray<bool> IsClose(NDArray a, NDArray b, double rtol = 1.0E-5, double atol = 1.0E-8, bool equal_nan = false);
public abstract NDArray<bool> IsFinite(NDArray a);
public abstract NDArray<bool> IsNan(NDArray a);
#endregion
#region Array Manipulation
public abstract NDArray CreateNDArray(Shape shape, Type dtype = null, Array buffer = null, char order = 'C');
public abstract NDArray CreateNDArray(Shape shape, Type dtype = null, IArraySlice buffer = null, char order = 'C');
public abstract NDArray Transpose(NDArray nd, int[] axes = null);
public abstract NDArray Cast(NDArray x, Type dtype, bool copy);
public abstract NDArray Cast(NDArray x, NPTypeCode dtype, bool copy);
#endregion
#region Sorting, searching, counting
#region Reduction
public abstract NDArray ReduceAMax(NDArray arr, int? axis_, bool keepdims = false, NPTypeCode? typeCode = null);
public abstract NDArray ReduceAMin(NDArray arr, int? axis_, bool keepdims = false, NPTypeCode? typeCode = null);
public abstract NDArray ReduceArgMax(NDArray arr, int? axis_);
public abstract NDArray ReduceArgMin(NDArray arr, int? axis_);
public abstract NDArray ReduceProduct(NDArray arr, int? axis_, bool keepdims = false, NPTypeCode? typeCode = null);
public abstract NDArray ReduceStd(NDArray arr, int? axis_, bool keepdims = false, int? ddof = null, NPTypeCode? typeCode = null);
public abstract NDArray ReduceVar(NDArray arr, int? axis_, bool keepdims = false, int? ddof = null, NPTypeCode? typeCode = null);
#endregion
public abstract NDArray ArgMax(in NDArray a);
public abstract NDArray ArgMax(in NDArray a, int axis);
public abstract NDArray ArgMin(in NDArray a);
public abstract NDArray ArgMin(in NDArray a, int axis);
public abstract NDArray AMax(in NDArray nd, int? axis = null, NPTypeCode? typeCode = null, bool keepdims = false);
public abstract NDArray AMax(in NDArray nd, int axis, Type dtype, bool keepdims = false);
public abstract NDArray AMin(in NDArray nd, int? axis = null, NPTypeCode? typeCode = null, bool keepdims = false);
public abstract NDArray AMin(in NDArray nd, int axis, Type dtype, bool keepdims = false);
#endregion
}
}