You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0a98fef
Browse filesBrowse the repository at this point in the historyBrowse files
A matrix log dependency utility. Useful for converting and testing algorithm behavior of CPU code to GPU code.
4
6
5
7
## Why?
@@ -17,9 +19,16 @@ Don't understand?
17
19
2. Think of the Leonardo 2's cannons talking with each other to build up their values and how this violates the laws of physics.
18
20
3. Have eureka moment.
19
21
22
+
## Installation
23
+
```bash
24
+
npm install matrix-log.js
25
+
```
26
+
20
27
## API
21
28
```js
22
-
import*asMatrixLogfrom'matrix-log';
29
+
constMatrixLog=require('matrix-log.js');
30
+
// or, from an ES module:
31
+
// import MatrixLog from 'matrix-log.js';
23
32
24
33
25
34
// create a matrix log that will have dependencies called
@@ -152,7 +161,7 @@ If you prefer to learn by code rather than have step by step instructions take a
152
161
for (let y =0; y <4; y++) {
153
162
let filterY = y <2?0:1;
154
163
for (let x =0; x <4; x++) {
155
-
let filterX = x <filter.length?0:1;
164
+
let filterX = x <2?0:1;
156
165
filters[filterY][filterX] += weights[y][x];
157
166
}
158
167
}
@@ -181,14 +190,17 @@ If you prefer to learn by code rather than have step by step instructions take a
181
190
for (let y = 0; y < 4; y++) {
182
191
let filterY = y < 2 ? 0 : 1;
183
192
for (let x = 0; x < 4; x++) {
184
-
let filterX = x < filter.length ? 0 : 1;
193
+
let filterX = x < 2 ? 0 : 1;
185
194
filters[filterY][filterX] += weights[y][x];
186
195
matrixLog
187
-
.at({ x, y })
196
+
.at({
197
+
x: filterX,
198
+
y: filterY
199
+
})
188
200
.add({
189
201
name: 'weights',
190
-
x: filterX,
191
-
y: filterY,
202
+
x,
203
+
y,
192
204
width: weights[0].length,
193
205
height: weights.length
194
206
});
@@ -293,7 +305,7 @@ If you prefer to learn by code rather than have step by step instructions take a
293
305
5. If we use a GPU environment, such as GPU.js, we could then then convert the kernel so that our algorithm actually works for setting the value of`filters` like this:
0 commit comments