|
4 | 4 |
|
5 | 5 | namespace Tensornet{ |
6 | 6 | public static class DotExtension{ |
| 7 | + /// <summary> |
| 8 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 9 | + /// </summary> |
| 10 | + /// <typeparam name="T"></typeparam> |
| 11 | + /// <param name="lhs"></param> |
| 12 | + /// <param name="rhs"></param> |
| 13 | + /// <returns></returns> |
7 | 14 | public static Tensor<T> Dot<T>(this Tensor<T> lhs, Tensor<T> rhs) where T : struct, IEquatable<T>, IConvertible{ |
8 | 15 | return DotInternal<T, T, T>(lhs, rhs); |
9 | 16 | } |
| 17 | + /// <summary> |
| 18 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 19 | + /// </summary> |
| 20 | + /// <typeparam name="T"></typeparam> |
| 21 | + /// <param name="lhs"></param> |
| 22 | + /// <param name="rhs"></param> |
| 23 | + /// <returns></returns> |
10 | 24 | public static Tensor<double> Dot(this Tensor<double> lhs, Tensor<int> rhs){ |
11 | 25 | return DotInternal<double, int, double>(lhs, rhs); |
12 | | - } |
| 26 | + }/// <summary> |
| 27 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 28 | + /// </summary> |
| 29 | + /// <typeparam name="T"></typeparam> |
| 30 | + /// <param name="lhs"></param> |
| 31 | + /// <param name="rhs"></param> |
| 32 | + /// <returns></returns> |
13 | 33 | public static Tensor<double> Dot(this Tensor<double> lhs, Tensor<float> rhs){ |
14 | 34 | return DotInternal<double, float, double>(lhs, rhs); |
15 | 35 | } |
| 36 | + /// <summary> |
| 37 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 38 | + /// </summary> |
| 39 | + /// <typeparam name="T"></typeparam> |
| 40 | + /// <param name="lhs"></param> |
| 41 | + /// <param name="rhs"></param> |
| 42 | + /// <returns></returns> |
16 | 43 | public static Tensor<double> Dot(this Tensor<double> lhs, Tensor<long> rhs){ |
17 | 44 | return DotInternal<double, long, double>(lhs, rhs); |
18 | 45 | } |
| 46 | + /// <summary> |
| 47 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 48 | + /// </summary> |
| 49 | + /// <typeparam name="T"></typeparam> |
| 50 | + /// <param name="lhs"></param> |
| 51 | + /// <param name="rhs"></param> |
| 52 | + /// <returns></returns> |
19 | 53 | public static Tensor<double> Dot(this Tensor<double> lhs, Tensor<bool> rhs){ |
20 | 54 | return DotInternal<double, bool, double>(lhs, rhs); |
21 | 55 | } |
| 56 | + /// <summary> |
| 57 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 58 | + /// </summary> |
| 59 | + /// <typeparam name="T"></typeparam> |
| 60 | + /// <param name="lhs"></param> |
| 61 | + /// <param name="rhs"></param> |
| 62 | + /// <returns></returns> |
22 | 63 | public static Tensor<double> Dot(this Tensor<int> lhs, Tensor<double> rhs){ |
23 | 64 | return DotInternal<int, double, double>(lhs, rhs); |
24 | 65 | } |
| 66 | + /// <summary> |
| 67 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 68 | + /// </summary> |
| 69 | + /// <typeparam name="T"></typeparam> |
| 70 | + /// <param name="lhs"></param> |
| 71 | + /// <param name="rhs"></param> |
| 72 | + /// <returns></returns> |
25 | 73 | public static Tensor<float> Dot(this Tensor<int> lhs, Tensor<float> rhs){ |
26 | 74 | return DotInternal<int, float, float>(lhs, rhs); |
27 | 75 | } |
| 76 | + /// <summary> |
| 77 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 78 | + /// </summary> |
| 79 | + /// <typeparam name="T"></typeparam> |
| 80 | + /// <param name="lhs"></param> |
| 81 | + /// <param name="rhs"></param> |
| 82 | + /// <returns></returns> |
28 | 83 | public static Tensor<long> Dot(this Tensor<int> lhs, Tensor<long> rhs){ |
29 | 84 | return DotInternal<int, long, long>(lhs, rhs); |
30 | 85 | } |
| 86 | + /// <summary> |
| 87 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 88 | + /// </summary> |
| 89 | + /// <typeparam name="T"></typeparam> |
| 90 | + /// <param name="lhs"></param> |
| 91 | + /// <param name="rhs"></param> |
| 92 | + /// <returns></returns> |
31 | 93 | public static Tensor<int> Dot(this Tensor<int> lhs, Tensor<bool> rhs){ |
32 | 94 | return DotInternal<int, bool, int>(lhs, rhs); |
33 | 95 | } |
| 96 | + /// <summary> |
| 97 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 98 | + /// </summary> |
| 99 | + /// <typeparam name="T"></typeparam> |
| 100 | + /// <param name="lhs"></param> |
| 101 | + /// <param name="rhs"></param> |
| 102 | + /// <returns></returns> |
34 | 103 | public static Tensor<double> Dot(this Tensor<long> lhs, Tensor<double> rhs){ |
35 | 104 | return DotInternal<long, double, double>(lhs, rhs); |
36 | 105 | } |
| 106 | + /// <summary> |
| 107 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 108 | + /// </summary> |
| 109 | + /// <typeparam name="T"></typeparam> |
| 110 | + /// <param name="lhs"></param> |
| 111 | + /// <param name="rhs"></param> |
| 112 | + /// <returns></returns> |
37 | 113 | public static Tensor<float> Dot(this Tensor<long> lhs, Tensor<float> rhs){ |
38 | 114 | return DotInternal<long, float, float>(lhs, rhs); |
39 | 115 | } |
| 116 | + /// <summary> |
| 117 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 118 | + /// </summary> |
| 119 | + /// <typeparam name="T"></typeparam> |
| 120 | + /// <param name="lhs"></param> |
| 121 | + /// <param name="rhs"></param> |
| 122 | + /// <returns></returns> |
40 | 123 | public static Tensor<long> Dot(this Tensor<long> lhs, Tensor<int> rhs){ |
41 | 124 | return DotInternal<long, int, long>(lhs, rhs); |
42 | 125 | } |
| 126 | + /// <summary> |
| 127 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 128 | + /// </summary> |
| 129 | + /// <typeparam name="T"></typeparam> |
| 130 | + /// <param name="lhs"></param> |
| 131 | + /// <param name="rhs"></param> |
| 132 | + /// <returns></returns> |
43 | 133 | public static Tensor<long> Dot(this Tensor<long> lhs, Tensor<bool> rhs){ |
44 | 134 | return DotInternal<long, bool, long>(lhs, rhs); |
45 | 135 | } |
| 136 | + /// <summary> |
| 137 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 138 | + /// </summary> |
| 139 | + /// <typeparam name="T"></typeparam> |
| 140 | + /// <param name="lhs"></param> |
| 141 | + /// <param name="rhs"></param> |
| 142 | + /// <returns></returns> |
46 | 143 | public static Tensor<float> Dot(this Tensor<float> lhs, Tensor<long> rhs){ |
47 | 144 | return DotInternal<float, long, float>(lhs, rhs); |
48 | 145 | } |
| 146 | + /// <summary> |
| 147 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 148 | + /// </summary> |
| 149 | + /// <typeparam name="T"></typeparam> |
| 150 | + /// <param name="lhs"></param> |
| 151 | + /// <param name="rhs"></param> |
| 152 | + /// <returns></returns> |
49 | 153 | public static Tensor<float> Dot(this Tensor<float> lhs, Tensor<int> rhs){ |
50 | 154 | return DotInternal<float, int, float>(lhs, rhs); |
51 | 155 | } |
| 156 | + /// <summary> |
| 157 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 158 | + /// </summary> |
| 159 | + /// <typeparam name="T"></typeparam> |
| 160 | + /// <param name="lhs"></param> |
| 161 | + /// <param name="rhs"></param> |
| 162 | + /// <returns></returns> |
52 | 163 | public static Tensor<float> Dot(this Tensor<float> lhs, Tensor<bool> rhs){ |
53 | 164 | return DotInternal<float, bool, float>(lhs, rhs); |
54 | 165 | } |
| 166 | + /// <summary> |
| 167 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 168 | + /// </summary> |
| 169 | + /// <typeparam name="T"></typeparam> |
| 170 | + /// <param name="lhs"></param> |
| 171 | + /// <param name="rhs"></param> |
| 172 | + /// <returns></returns> |
55 | 173 | public static Tensor<double> Dot(this Tensor<float> lhs, Tensor<double> rhs){ |
56 | 174 | return DotInternal<float, double, double>(lhs, rhs); |
57 | 175 | } |
| 176 | + /// <summary> |
| 177 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 178 | + /// </summary> |
| 179 | + /// <typeparam name="T"></typeparam> |
| 180 | + /// <param name="lhs"></param> |
| 181 | + /// <param name="rhs"></param> |
| 182 | + /// <returns></returns> |
58 | 183 | public static Tensor<double> Dot(this Tensor<bool> lhs, Tensor<double> rhs){ |
59 | 184 | return DotInternal<bool, double, double>(lhs, rhs); |
60 | 185 | } |
| 186 | + /// <summary> |
| 187 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 188 | + /// </summary> |
| 189 | + /// <typeparam name="T"></typeparam> |
| 190 | + /// <param name="lhs"></param> |
| 191 | + /// <param name="rhs"></param> |
| 192 | + /// <returns></returns> |
61 | 193 | public static Tensor<float> Dot(this Tensor<bool> lhs, Tensor<float> rhs){ |
62 | 194 | return DotInternal<bool, float, float>(lhs, rhs); |
63 | 195 | } |
| 196 | + /// <summary> |
| 197 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 198 | + /// </summary> |
| 199 | + /// <typeparam name="T"></typeparam> |
| 200 | + /// <param name="lhs"></param> |
| 201 | + /// <param name="rhs"></param> |
| 202 | + /// <returns></returns> |
64 | 203 | public static Tensor<long> Dot(this Tensor<bool> lhs, Tensor<long> rhs){ |
65 | 204 | return DotInternal<bool, long, long>(lhs, rhs); |
66 | 205 | } |
| 206 | + /// <summary> |
| 207 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 208 | + /// </summary> |
| 209 | + /// <typeparam name="T"></typeparam> |
| 210 | + /// <param name="lhs"></param> |
| 211 | + /// <param name="rhs"></param> |
| 212 | + /// <returns></returns> |
67 | 213 | public static Tensor<int> Dot(this Tensor<bool> lhs, Tensor<int> rhs){ |
68 | 214 | return DotInternal<bool, int, int>(lhs, rhs); |
69 | 215 | } |
| 216 | + /// <summary> |
| 217 | + /// Get the dot result of the two tensors. For the details, please refer to https://numpy.org/doc/stable/reference/generated/numpy.dot.html#numpy.dot |
| 218 | + /// </summary> |
| 219 | + /// <typeparam name="T"></typeparam> |
| 220 | + /// <param name="lhs"></param> |
| 221 | + /// <param name="rhs"></param> |
| 222 | + /// <returns></returns> |
70 | 223 | private static Tensor<TC> DotInternal<TA, TB, TC>(Tensor<TA> lhs, Tensor<TB> rhs) |
71 | 224 | where TA : struct, IEquatable<TA>, IConvertible |
72 | 225 | where TB : struct, IEquatable<TB>, IConvertible |
|
0 commit comments