Skip to content

Commit ca01599

Browse files
committed
Fixing the Cuda compilation
1 parent 439bb87 commit ca01599

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

dlib/cuda/cublas_dlibapi.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ namespace dlib
102102
bool trans_lhs,
103103
const tensor& rhs,
104104
bool trans_rhs,
105-
tt::operation_mode mode
105+
operation_mode mode
106106
)
107107
{
108-
if (mode == tt::operation_mode::CHANNEL_WISE)
108+
if (mode == operation_mode::CHANNEL_WISE)
109109
{
110110
// Recall that BLAS uses column major order so to deal with that we flip the
111111
// order of the lhs and rhs arguments.
@@ -154,7 +154,7 @@ namespace dlib
154154
&beta,
155155
dest.device(), dest_nc));
156156
}
157-
else if (mode == tt::operation_mode::PLANE_WISE)
157+
else if (mode == operation_mode::PLANE_WISE)
158158
{
159159
const auto transa = trans_lhs ? CUBLAS_OP_T : CUBLAS_OP_N;
160160
const auto transb = trans_rhs ? CUBLAS_OP_T : CUBLAS_OP_N;

dlib/cuda/cublas_dlibapi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
#include "cuda_errors.h"
1010

1111
namespace dlib
12-
{
12+
{
1313
namespace cuda
14-
{
14+
{
1515

1616
// -----------------------------------------------------------------------------------
1717

@@ -23,7 +23,7 @@ namespace dlib
2323
bool trans_lhs,
2424
const tensor& rhs,
2525
bool trans_rhs,
26-
tt::operation_mode mode = tt::operation_mode::CHANNEL_WISE
26+
operation_mode mode = operation_mode::CHANNEL_WISE
2727
);
2828
/*!
2929
requires

dlib/cuda/tensor.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
namespace dlib
1616
{
1717

18+
// ----------------------------------------------------------------------------------------
19+
20+
/*!
21+
This enum is used to determine the mode of operation for certain functions
22+
(such as gemm and softmax) in Dlib. It specifies whether the calculation
23+
should be performed based on the matrix field in nr()xnc() or if the matrix
24+
should be considered in num_samples()xk(). This helps in organizing tensor
25+
computations more efficiently according to the required dimensions.
26+
!*/
27+
enum class operation_mode { CHANNEL_WISE = 0, PLANE_WISE = 1 };
28+
1829
// ----------------------------------------------------------------------------------------
1930

2031
class tensor;

dlib/cuda/tensor_tools.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,13 @@ namespace dlib { namespace tt
209209
bool trans_lhs,
210210
const tensor& rhs,
211211
bool trans_rhs,
212-
tt::operation_mode mode
212+
operation_mode mode
213213
)
214214
{
215215
#ifdef DLIB_USE_CUDA
216216
cuda::gemm(beta, dest, alpha, lhs, trans_lhs, rhs, trans_rhs, mode);
217217
#else
218-
if (mode == tt::operation_mode::CHANNEL_WISE)
218+
if (mode == operation_mode::CHANNEL_WISE)
219219
{
220220
if (beta != 0)
221221
{
@@ -240,7 +240,7 @@ namespace dlib { namespace tt
240240
dest = alpha * mat(lhs) * mat(rhs);
241241
}
242242
}
243-
else if (mode == tt::operation_mode::PLANE_WISE)
243+
else if (mode == operation_mode::PLANE_WISE)
244244
{
245245
auto is_matrix = [](const auto& tensor) {
246246
return ((tensor.num_samples() * tensor.k() == 1 && tensor.nr() * tensor.nc() > 1) ||

dlib/cuda/tensor_tools.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,6 @@ namespace dlib
2525
namespace dlib { namespace tt
2626
{
2727

28-
// ----------------------------------------------------------------------------------------
29-
30-
/*!
31-
This enum is used to determine the mode of operation for certain functions
32-
(such as gemm and softmax) in Dlib. It specifies whether the calculation
33-
should be performed based on the matrix field in nr()xnc() or if the matrix
34-
should be considered in num_samples()xk(). This helps in organizing tensor
35-
computations more efficiently according to the required dimensions.
36-
!*/
37-
enum class operation_mode { CHANNEL_WISE = 0, PLANE_WISE = 1 };
38-
3928
// ----------------------------------------------------------------------------------------
4029

4130
void inverse_norms (
@@ -177,7 +166,7 @@ namespace dlib { namespace tt
177166
bool trans_lhs,
178167
const tensor& rhs,
179168
bool trans_rhs,
180-
tt::operation_mode mode = tt::operation_mode::CHANNEL_WISE
169+
operation_mode mode = operation_mode::CHANNEL_WISE
181170
);
182171
/*!
183172
requires

dlib/dnn/layers.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2809,7 +2809,7 @@ namespace dlib
28092809
auto& t2 = layer<tag>(sub).get_output();
28102810
output.set_size(t1.num_samples(), t1.k(), t1.nr(), t2.nc());
28112811

2812-
tt::gemm(0, output, 1, t1, false, t2, false, tt::operation_mode::PLANE_WISE);
2812+
tt::gemm(0, output, 1, t1, false, t2, false, operation_mode::PLANE_WISE);
28132813
}
28142814

28152815
template <typename SUBNET>
@@ -2820,8 +2820,8 @@ namespace dlib
28202820
auto& prev = sub.get_gradient_input();
28212821
auto& prev_tag = layer<tag>(sub).get_gradient_input();
28222822

2823-
tt::gemm(1, prev, 1, gradient_input, false, t2, true, tt::operation_mode::PLANE_WISE);
2824-
tt::gemm(1, prev_tag, 1, t1, true, gradient_input, false, tt::operation_mode::PLANE_WISE);
2823+
tt::gemm(1, prev, 1, gradient_input, false, t2, true, operation_mode::PLANE_WISE);
2824+
tt::gemm(1, prev_tag, 1, t1, true, gradient_input, false, operation_mode::PLANE_WISE);
28252825
}
28262826

28272827
const tensor& get_layer_params() const { return params; }

0 commit comments

Comments
 (0)