wincnn 2.0.0__py3-none-any.whl → 2.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wincnn-2.0.1.dist-info/METADATA +261 -0
- wincnn-2.0.1.dist-info/RECORD +6 -0
- wincnn-2.0.0.dist-info/METADATA +0 -11
- wincnn-2.0.0.dist-info/RECORD +0 -6
- {wincnn-2.0.0.dist-info → wincnn-2.0.1.dist-info}/WHEEL +0 -0
- {wincnn-2.0.0.dist-info → wincnn-2.0.1.dist-info}/licenses/LICENSE +0 -0
- {wincnn-2.0.0.dist-info → wincnn-2.0.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wincnn
|
|
3
|
+
Version: 2.0.1
|
|
4
|
+
Summary: Compute minimal Winograd convolution algorithms for convolutional neural networks
|
|
5
|
+
Author-email: Andrew Lavin <alavin@acm.org>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/andravin/wincnn
|
|
8
|
+
Project-URL: Repository, https://github.com/andravin/wincnn
|
|
9
|
+
Project-URL: Changelog, https://github.com/andravin/wincnn/blob/master/CHANGELOG.md
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: sympy>=1.9
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# wincnn
|
|
28
|
+
|
|
29
|
+
[](https://pypi.org/project/wincnn/)
|
|
30
|
+
[](https://pypi.org/project/wincnn/)
|
|
31
|
+
[](https://github.com/andravin/wincnn/blob/master/LICENSE)
|
|
32
|
+
|
|
33
|
+
A simple python module for computing minimal Winograd convolution algorithms for use with
|
|
34
|
+
convolutional neural networks as proposed in [1].
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
pip install wincnn
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Requirements
|
|
43
|
+
|
|
44
|
+
+ Python >= 3.8
|
|
45
|
+
+ SymPy >= 1.9
|
|
46
|
+
|
|
47
|
+
## Example: F(2,3)
|
|
48
|
+
|
|
49
|
+
For F(m,r) you must select m+r-2 polynomial interpolation points.
|
|
50
|
+
|
|
51
|
+
In this example we compute transforms for F(2,3) or
|
|
52
|
+
F(2x2,3x3) using polynomial interpolation points (0,1,-1).
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
$ python3
|
|
56
|
+
>>> import wincnn
|
|
57
|
+
>>> wincnn.showCookToomFilter((0,1,-1), 2, 3)
|
|
58
|
+
AT =
|
|
59
|
+
⎡1 1 1 0⎤
|
|
60
|
+
⎢ ⎥
|
|
61
|
+
⎣0 1 -1 1⎦
|
|
62
|
+
|
|
63
|
+
G =
|
|
64
|
+
⎡ 1 0 0 ⎤
|
|
65
|
+
⎢ ⎥
|
|
66
|
+
⎢1/2 1/2 1/2⎥
|
|
67
|
+
⎢ ⎥
|
|
68
|
+
⎢1/2 -1/2 1/2⎥
|
|
69
|
+
⎢ ⎥
|
|
70
|
+
⎣ 0 0 1 ⎦
|
|
71
|
+
|
|
72
|
+
BT =
|
|
73
|
+
⎡1 0 -1 0⎤
|
|
74
|
+
⎢ ⎥
|
|
75
|
+
⎢0 1 1 0⎥
|
|
76
|
+
⎢ ⎥
|
|
77
|
+
⎢0 -1 1 0⎥
|
|
78
|
+
⎢ ⎥
|
|
79
|
+
⎣0 -1 0 1⎦
|
|
80
|
+
|
|
81
|
+
AT*((G*g)(BT*d)) =
|
|
82
|
+
⎡d[0]⋅g[0] + d[1]⋅g[1] + d[2]⋅g[2]⎤
|
|
83
|
+
⎢ ⎥
|
|
84
|
+
⎣d[1]⋅g[0] + d[2]⋅g[1] + d[3]⋅g[2]⎦
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The last matrix is the 1D convolution F(2,3) computed using the
|
|
89
|
+
transforms AT, G, and BT, on 4 element signal d[0..3] and 3 element
|
|
90
|
+
filter g[0..2], and serves to verify the correctness of the
|
|
91
|
+
transforms. This is a symbolic computation, so the result should be
|
|
92
|
+
exact.
|
|
93
|
+
|
|
94
|
+
## Example: F(4,3)
|
|
95
|
+
|
|
96
|
+
The following example computes transforms for F(4,3).
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
>>> wincnn.showCookToomFilter((0,1,-1,2,-2), 4, 3)
|
|
100
|
+
AT =
|
|
101
|
+
⎡1 1 1 1 1 0⎤
|
|
102
|
+
⎢ ⎥
|
|
103
|
+
⎢0 1 -1 2 -2 0⎥
|
|
104
|
+
⎢ ⎥
|
|
105
|
+
⎢0 1 1 4 4 0⎥
|
|
106
|
+
⎢ ⎥
|
|
107
|
+
⎣0 1 -1 8 -8 1⎦
|
|
108
|
+
|
|
109
|
+
G =
|
|
110
|
+
⎡1/4 0 0 ⎤
|
|
111
|
+
⎢ ⎥
|
|
112
|
+
⎢-1/6 -1/6 -1/6⎥
|
|
113
|
+
⎢ ⎥
|
|
114
|
+
⎢-1/6 1/6 -1/6⎥
|
|
115
|
+
⎢ ⎥
|
|
116
|
+
⎢1/24 1/12 1/6 ⎥
|
|
117
|
+
⎢ ⎥
|
|
118
|
+
⎢1/24 -1/12 1/6 ⎥
|
|
119
|
+
⎢ ⎥
|
|
120
|
+
⎣ 0 0 1 ⎦
|
|
121
|
+
|
|
122
|
+
BT =
|
|
123
|
+
⎡4 0 -5 0 1 0⎤
|
|
124
|
+
⎢ ⎥
|
|
125
|
+
⎢0 -4 -4 1 1 0⎥
|
|
126
|
+
⎢ ⎥
|
|
127
|
+
⎢0 4 -4 -1 1 0⎥
|
|
128
|
+
⎢ ⎥
|
|
129
|
+
⎢0 -2 -1 2 1 0⎥
|
|
130
|
+
⎢ ⎥
|
|
131
|
+
⎢0 2 -1 -2 1 0⎥
|
|
132
|
+
⎢ ⎥
|
|
133
|
+
⎣0 4 0 -5 0 1⎦
|
|
134
|
+
|
|
135
|
+
AT*((G*g)(BT*d)) =
|
|
136
|
+
⎡d[0]⋅g[0] + d[1]⋅g[1] + d[2]⋅g[2]⎤
|
|
137
|
+
⎢ ⎥
|
|
138
|
+
⎢d[1]⋅g[0] + d[2]⋅g[1] + d[3]⋅g[2]⎥
|
|
139
|
+
⎢ ⎥
|
|
140
|
+
⎢d[2]⋅g[0] + d[3]⋅g[1] + d[4]⋅g[2]⎥
|
|
141
|
+
⎢ ⎥
|
|
142
|
+
⎣d[3]⋅g[0] + d[4]⋅g[1] + d[5]⋅g[2]⎦
|
|
143
|
+
```
|
|
144
|
+
## Linear Convolution
|
|
145
|
+
|
|
146
|
+
If instead of an FIR filter you want the algorithm for linear convolution, all you have to do is exchange and transpose the data and inverse transform matrices. This is referred to as the Transfomation Principle.
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
>>> wincnn.showCookToomConvolution((0,1,-1),2,3)
|
|
150
|
+
A =
|
|
151
|
+
⎡1 0 ⎤
|
|
152
|
+
⎢ ⎥
|
|
153
|
+
⎢1 1 ⎥
|
|
154
|
+
⎢ ⎥
|
|
155
|
+
⎢1 -1⎥
|
|
156
|
+
⎢ ⎥
|
|
157
|
+
⎣0 1 ⎦
|
|
158
|
+
|
|
159
|
+
G =
|
|
160
|
+
⎡ 1 0 0 ⎤
|
|
161
|
+
⎢ ⎥
|
|
162
|
+
⎢1/2 1/2 1/2⎥
|
|
163
|
+
⎢ ⎥
|
|
164
|
+
⎢1/2 -1/2 1/2⎥
|
|
165
|
+
⎢ ⎥
|
|
166
|
+
⎣ 0 0 1 ⎦
|
|
167
|
+
|
|
168
|
+
B =
|
|
169
|
+
⎡1 0 0 0 ⎤
|
|
170
|
+
⎢ ⎥
|
|
171
|
+
⎢0 1 -1 -1⎥
|
|
172
|
+
⎢ ⎥
|
|
173
|
+
⎢-1 1 1 0 ⎥
|
|
174
|
+
⎢ ⎥
|
|
175
|
+
⎣0 0 0 1 ⎦
|
|
176
|
+
|
|
177
|
+
Linear Convolution: B*((G*g)(A*d)) =
|
|
178
|
+
⎡ d[0]⋅g[0] ⎤
|
|
179
|
+
⎢ ⎥
|
|
180
|
+
⎢d[0]⋅g[1] + d[1]⋅g[0]⎥
|
|
181
|
+
⎢ ⎥
|
|
182
|
+
⎢d[0]⋅g[2] + d[1]⋅g[1]⎥
|
|
183
|
+
⎢ ⎥
|
|
184
|
+
⎣ d[1]⋅g[2] ⎦
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Example: F(6,3)
|
|
188
|
+
|
|
189
|
+
This example computes transform for F(6,3). We will use fraction interpolation points 1/2
|
|
190
|
+
and -1/2, so we use sympy.Rational in order to keep the symbolic computation exact (using floating point values would make the derivation of the transforms subject to rounding error).
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
>>> from sympy import Rational
|
|
194
|
+
>>> wincnn.showCookToomFilter((0,1,-1,2,-2,Rational(1,2),-Rational(1,2)), 6, 3)
|
|
195
|
+
AT =
|
|
196
|
+
⎡1 1 1 1 1 1 1 0⎤
|
|
197
|
+
⎢ ⎥
|
|
198
|
+
⎢0 1 -1 2 -2 1/2 -1/2 0⎥
|
|
199
|
+
⎢ ⎥
|
|
200
|
+
⎢0 1 1 4 4 1/4 1/4 0⎥
|
|
201
|
+
⎢ ⎥
|
|
202
|
+
⎢0 1 -1 8 -8 1/8 -1/8 0⎥
|
|
203
|
+
⎢ ⎥
|
|
204
|
+
⎢0 1 1 16 16 1/16 1/16 0⎥
|
|
205
|
+
⎢ ⎥
|
|
206
|
+
⎣0 1 -1 32 -32 1/32 -1/32 1⎦
|
|
207
|
+
|
|
208
|
+
G =
|
|
209
|
+
⎡ 1 0 0 ⎤
|
|
210
|
+
⎢ ⎥
|
|
211
|
+
⎢-2/9 -2/9 -2/9⎥
|
|
212
|
+
⎢ ⎥
|
|
213
|
+
⎢-2/9 2/9 -2/9⎥
|
|
214
|
+
⎢ ⎥
|
|
215
|
+
⎢1/90 1/45 2/45⎥
|
|
216
|
+
⎢ ⎥
|
|
217
|
+
⎢1/90 -1/45 2/45⎥
|
|
218
|
+
⎢ ⎥
|
|
219
|
+
⎢ 32 16 ⎥
|
|
220
|
+
⎢ ── ── 8/45⎥
|
|
221
|
+
⎢ 45 45 ⎥
|
|
222
|
+
⎢ ⎥
|
|
223
|
+
⎢ 32 -16 ⎥
|
|
224
|
+
⎢ ── ──── 8/45⎥
|
|
225
|
+
⎢ 45 45 ⎥
|
|
226
|
+
⎢ ⎥
|
|
227
|
+
⎣ 0 0 1 ⎦
|
|
228
|
+
|
|
229
|
+
BT =
|
|
230
|
+
⎡1 0 -21/4 0 21/4 0 -1 0⎤
|
|
231
|
+
⎢ ⎥
|
|
232
|
+
⎢0 1 1 -17/4 -17/4 1 1 0⎥
|
|
233
|
+
⎢ ⎥
|
|
234
|
+
⎢0 -1 1 17/4 -17/4 -1 1 0⎥
|
|
235
|
+
⎢ ⎥
|
|
236
|
+
⎢0 1/2 1/4 -5/2 -5/4 2 1 0⎥
|
|
237
|
+
⎢ ⎥
|
|
238
|
+
⎢0 -1/2 1/4 5/2 -5/4 -2 1 0⎥
|
|
239
|
+
⎢ ⎥
|
|
240
|
+
⎢0 2 4 -5/2 -5 1/2 1 0⎥
|
|
241
|
+
⎢ ⎥
|
|
242
|
+
⎢0 -2 4 5/2 -5 -1/2 1 0⎥
|
|
243
|
+
⎢ ⎥
|
|
244
|
+
⎣0 -1 0 21/4 0 -21/4 0 1⎦
|
|
245
|
+
|
|
246
|
+
AT*((G*g)(BT*d)) =
|
|
247
|
+
⎡d[0]⋅g[0] + d[1]⋅g[1] + d[2]⋅g[2]⎤
|
|
248
|
+
⎢ ⎥
|
|
249
|
+
⎢d[1]⋅g[0] + d[2]⋅g[1] + d[3]⋅g[2]⎥
|
|
250
|
+
⎢ ⎥
|
|
251
|
+
⎢d[2]⋅g[0] + d[3]⋅g[1] + d[4]⋅g[2]⎥
|
|
252
|
+
⎢ ⎥
|
|
253
|
+
⎢d[3]⋅g[0] + d[4]⋅g[1] + d[5]⋅g[2]⎥
|
|
254
|
+
⎢ ⎥
|
|
255
|
+
⎢d[4]⋅g[0] + d[5]⋅g[1] + d[6]⋅g[2]⎥
|
|
256
|
+
⎢ ⎥
|
|
257
|
+
⎣d[5]⋅g[0] + d[6]⋅g[1] + d[7]⋅g[2]⎦
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
[1] "Fast Algorithms for Convolutional Neural Networks" Lavin and Gray, CVPR 2016.
|
|
261
|
+
http://www.cv-foundation.org/openaccess/content_cvpr_2016/papers/Lavin_Fast_Algorithms_for_CVPR_2016_paper.pdf
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
wincnn.py,sha256=FE4sLQq3uBJB5PJn-merVfFBsM92u31pf0CHw-Jiwxc,5860
|
|
2
|
+
wincnn-2.0.1.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
3
|
+
wincnn-2.0.1.dist-info/METADATA,sha256=DSFOpwnD086PernsEijI4A040ZknW0wU4mkGyokgXT4,7574
|
|
4
|
+
wincnn-2.0.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
5
|
+
wincnn-2.0.1.dist-info/top_level.txt,sha256=QVtEdJb2oyKFRQGn4aMs0XteIK_WSadnxlCQhT6XgNQ,7
|
|
6
|
+
wincnn-2.0.1.dist-info/RECORD,,
|
wincnn-2.0.0.dist-info/METADATA
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: wincnn
|
|
3
|
-
Version: 2.0.0
|
|
4
|
-
Summary: Compute minimal Winograd convolution algorithms for convolutional neural networks
|
|
5
|
-
License: Apache-2.0
|
|
6
|
-
Requires-Python: >=3.8
|
|
7
|
-
License-File: LICENSE
|
|
8
|
-
Requires-Dist: sympy>=1.9
|
|
9
|
-
Provides-Extra: dev
|
|
10
|
-
Requires-Dist: pytest; extra == "dev"
|
|
11
|
-
Dynamic: license-file
|
wincnn-2.0.0.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
wincnn.py,sha256=FE4sLQq3uBJB5PJn-merVfFBsM92u31pf0CHw-Jiwxc,5860
|
|
2
|
-
wincnn-2.0.0.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
3
|
-
wincnn-2.0.0.dist-info/METADATA,sha256=YF9SgiTXqNWEyQIUBQAB1Z0inRLQE3E7R04aenbTxCI,312
|
|
4
|
-
wincnn-2.0.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
5
|
-
wincnn-2.0.0.dist-info/top_level.txt,sha256=QVtEdJb2oyKFRQGn4aMs0XteIK_WSadnxlCQhT6XgNQ,7
|
|
6
|
-
wincnn-2.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|