forked from victoroliv2/halide-casestudies
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_depth.cpp
More file actions
47 lines (33 loc) · 758 Bytes
/
test_depth.cpp
File metadata and controls
47 lines (33 loc) · 758 Bytes
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
#include "Halide.h"
using namespace Halide;
#include "image_io.h"
#include <iostream>
#include <limits>
#include <cfloat>
#include <sys/time.h>
Var x, y, f1, f2, batch;
int main(int argc, char * argv[])
{
#define DATASET_SIZE 1024
#define KERNEL_0 10
// it works if this is 10, but I'm not sure why
#define KERNEL_1 50
Image<float> input (28, 28, DATASET_SIZE);
Image<float> fmask2(5, 5, KERNEL_0, KERNEL_1);
Func layer1("layer1");
RDom R(0, 5,
0, 5,
0, KERNEL_0);
layer1(x, y, f2, batch) += fmask2(R.x, R.y, R.z, f2);
if (use_gpu())
{
layer1.root().cudaTile(x,y,4,4);
}
else
{
layer1.root();
}
Image<float> out(8, 8, KERNEL_1, DATASET_SIZE);
layer1.realize(out);
return 0;
}