Skip to content

Commit 56e23fa

Browse files
kloudkljeffdonahue
authored andcommitted
Device wrapper methods no longer pure virtual, default not implemented
Conflicts: include/caffe/util/device.hpp
1 parent 31fb4b9 commit 56e23fa

File tree

1 file changed

+40
-28
lines changed

1 file changed

+40
-28
lines changed

include/caffe/util/device.hpp

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,73 +21,85 @@ class Device {
2121
virtual void gemm(const CBLAS_TRANSPOSE TransA, const CBLAS_TRANSPOSE TransB,
2222
const int M, const int N, const int K, const Dtype alpha,
2323
const Dtype* A, const Dtype* B, const Dtype beta,
24-
Dtype* C) = 0;
24+
Dtype* C) { NOT_IMPLEMENTED; }
2525

2626
virtual void gemv(const CBLAS_TRANSPOSE TransA, const int M, const int N,
2727
const Dtype alpha, const Dtype* A, const Dtype* x,
28-
const Dtype beta, Dtype* y) = 0;
28+
const Dtype beta, Dtype* y) { NOT_IMPLEMENTED; }
2929

3030
virtual void axpy(const int N, const Dtype alpha, const Dtype* X,
31-
Dtype* Y) = 0;
31+
Dtype* Y) { NOT_IMPLEMENTED; }
3232

3333
virtual void axpby(const int N, const Dtype alpha, const Dtype* X,
34-
const Dtype beta, Dtype* Y) = 0;
34+
const Dtype beta, Dtype* Y) { NOT_IMPLEMENTED; }
3535

36-
virtual void copy(const int N, const Dtype *X, Dtype *Y) = 0;
37-
virtual void copy_from_cpu(const int N, const Dtype* X, Dtype* Y) = 0;
36+
virtual void copy(const int N, const Dtype *X, Dtype *Y) { NOT_IMPLEMENTED; }
37+
virtual void copy_from_cpu(const int N, const Dtype* X, Dtype* Y) {
38+
NOT_IMPLEMENTED; }
3839

39-
virtual void set(const int N, const Dtype alpha, Dtype *X) = 0;
40+
virtual void set(const int N, const Dtype alpha, Dtype *X) {
41+
NOT_IMPLEMENTED; }
4042

41-
virtual void add_scalar(const int N, const Dtype alpha, Dtype *X) = 0;
43+
virtual void add_scalar(const int N, const Dtype alpha, Dtype *X) {
44+
NOT_IMPLEMENTED; }
4245

43-
virtual void scal(const int N, const Dtype alpha, Dtype *X) = 0;
46+
virtual void scal(const int N, const Dtype alpha, Dtype *X) {
47+
NOT_IMPLEMENTED; }
4448

45-
virtual void sqr(const int N, const Dtype* a, Dtype* y) = 0;
49+
virtual void sqr(const int N, const Dtype* a, Dtype* y) { NOT_IMPLEMENTED; }
4650

47-
virtual void add(const int N, const Dtype* a, const Dtype* b, Dtype* y) = 0;
51+
virtual void add(const int N, const Dtype* a, const Dtype* b, Dtype* y) {
52+
NOT_IMPLEMENTED; }
4853

49-
virtual void sub(const int N, const Dtype* a, const Dtype* b, Dtype* y) = 0;
54+
virtual void sub(const int N, const Dtype* a, const Dtype* b, Dtype* y) {
55+
NOT_IMPLEMENTED; }
5056

51-
virtual void mul(const int N, const Dtype* a, const Dtype* b, Dtype* y) = 0;
57+
virtual void mul(const int N, const Dtype* a, const Dtype* b, Dtype* y) {
58+
NOT_IMPLEMENTED; }
5259

53-
virtual void div(const int N, const Dtype* a, const Dtype* b, Dtype* y) = 0;
60+
virtual void div(const int N, const Dtype* a, const Dtype* b, Dtype* y) {
61+
NOT_IMPLEMENTED; }
5462

55-
virtual void powx(const int N, const Dtype* a, const Dtype b, Dtype* y) = 0;
63+
virtual void powx(const int N, const Dtype* a, const Dtype b, Dtype* y) {
64+
NOT_IMPLEMENTED; }
5665

5766
virtual void rng_uniform(const int N, const Dtype a, const Dtype b,
58-
Dtype* r) = 0;
67+
Dtype* r) { NOT_IMPLEMENTED; }
5968

6069
virtual void rng_gaussian(const int N, const Dtype mu, const Dtype sigma,
61-
Dtype* r) = 0;
70+
Dtype* r) { NOT_IMPLEMENTED; }
6271

63-
virtual void rng_bernoulli(const int N, const Dtype p, int* r) = 0;
72+
virtual void rng_bernoulli(const int N, const Dtype p, int* r) {
73+
NOT_IMPLEMENTED; }
6474

65-
virtual void exp(const int N, const Dtype* a, Dtype* y) = 0;
75+
virtual void exp(const int N, const Dtype* a, Dtype* y) { NOT_IMPLEMENTED; }
6676

67-
virtual void dot(const int N, const Dtype* x, const Dtype* y, Dtype* out) = 0;
77+
virtual void dot(const int N, const Dtype* x, const Dtype* y, Dtype* out) {
78+
NOT_IMPLEMENTED; }
6879

6980
virtual void hamming_distance(const int N, const Dtype* x, const Dtype* y,
70-
uint32_t* out) = 0;
81+
uint32_t* out) { NOT_IMPLEMENTED; }
7182

7283
// Returns the sum of the absolute values of the elements of vector x
73-
virtual void asum(const int N, const Dtype* x, Dtype* y) = 0;
84+
virtual void asum(const int N, const Dtype* x, Dtype* y) { NOT_IMPLEMENTED; }
7485

75-
virtual void sign(const int N, const Dtype* x, Dtype* y) = 0;
86+
virtual void sign(const int N, const Dtype* x, Dtype* y) { NOT_IMPLEMENTED; }
7687

77-
virtual void sgnbit(const int N, const Dtype* x, Dtype* y) = 0;
88+
virtual void sgnbit(const int N, const Dtype* x, Dtype* y) {
89+
NOT_IMPLEMENTED; }
7890

79-
virtual void fabs(const int N, const Dtype* x, Dtype* y) = 0;
91+
virtual void fabs(const int N, const Dtype* x, Dtype* y) { NOT_IMPLEMENTED; }
8092

8193
virtual void scale(const int N, const Dtype alpha, const Dtype *x,
82-
Dtype* y) = 0;
94+
Dtype* y) { NOT_IMPLEMENTED; }
8395

8496
virtual void im2col(const Dtype* data_im, const int channels,
8597
const int height, const int width, const int ksize, const int pad,
86-
const int stride, Dtype* data_col) = 0;
98+
const int stride, Dtype* data_col) { NOT_IMPLEMENTED; }
8799

88100
virtual void col2im(const Dtype* data_col, const int channels,
89101
const int height, const int width, const int psize, const int pad,
90-
const int stride, Dtype* data_im) = 0;
102+
const int stride, Dtype* data_im) { NOT_IMPLEMENTED; }
91103
};
92104

93105
template<typename Dtype>

0 commit comments

Comments
 (0)