forked from larryniven/nn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nn-gpu.h
41 lines (25 loc) · 918 Bytes
/
nn-gpu.h
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
#ifndef NN_GPU_H
#define NN_GPU_H
#include "nn/nn.h"
#include "la/la-gpu.h"
namespace nn {
namespace gpu {
struct l2_loss {
la::gpu::tensor_like<double> const& gold;
la::gpu::tensor_like<double> const& pred;
l2_loss(la::gpu::tensor_like<double> const& gold,
la::gpu::tensor_like<double> const& pred);
double loss();
la::gpu::tensor<double> grad(double scale=1);
};
struct log_loss {
la::gpu::tensor_like<double> const& pred;
la::gpu::tensor_like<double> const& gold;
log_loss(la::gpu::tensor_like<double> const& gold,
la::gpu::tensor_like<double> const& pred);
double loss();
la::gpu::tensor<double> grad(double scale = 1);
};
}
}
#endif