Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
d3f12d83
Commit
d3f12d83
authored
9 years ago
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added more overloads of affine_transform()
parent
7d5fb9c6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
4 deletions
+95
-4
cuda_dlib.cu
dlib/dnn/cuda_dlib.cu
+23
-0
cuda_dlib.h
dlib/dnn/cuda_dlib.h
+14
-0
tensor_tools.cpp
dlib/dnn/tensor_tools.cpp
+28
-0
tensor_tools.h
dlib/dnn/tensor_tools.h
+30
-4
No files found.
dlib/dnn/cuda_dlib.cu
View file @
d3f12d83
...
...
@@ -267,6 +267,16 @@ namespace dlib
launch_kernel(_cuda_affine_transform1_0,max_jobs(dest.size()),dest.device(), src.device(), src.size(), A);
}
void affine_transform(
tensor& dest,
const tensor& src,
const float A
)
{
DLIB_CASSERT(dest.size()==src.size(),"");
launch_kernel(_cuda_affine_transform1_0,max_jobs(dest.size()),dest.device(), src.device(), src.size(), A);
}
// ----------------------------------------------------------------------------------------
__global__ void _cuda_affine_transform4(float* d, const float* s1, const float* s2, size_t n, float A, float B, float C)
...
...
@@ -302,6 +312,19 @@ namespace dlib
launch_kernel(_cuda_affine_transform4_0,max_jobs(dest.size()),dest.device(), src1.device(), src2.device(), dest.size(), A, B);
}
void affine_transform(
tensor& dest,
const tensor& src1,
const tensor& src2,
const float A,
const float B
)
{
DLIB_CASSERT(dest.size()==src1.size(),"");
DLIB_CASSERT(dest.size()==src2.size(),"");
launch_kernel(_cuda_affine_transform4_0,max_jobs(dest.size()),dest.device(), src1.device(), src2.device(), dest.size(), A, B);
}
// ----------------------------------------------------------------------------------------
__global__ void _cuda_add_scaled(float* d, const float* s, size_t n, float scale)
...
...
This diff is collapsed.
Click to expand it.
dlib/dnn/cuda_dlib.h
View file @
d3f12d83
...
...
@@ -54,6 +54,12 @@ namespace dlib
const
float
B
);
void
affine_transform
(
tensor
&
dest
,
const
tensor
&
src
,
const
float
A
);
void
affine_transform
(
tensor
&
dest
,
const
tensor
&
src1
,
...
...
@@ -63,6 +69,14 @@ namespace dlib
const
float
C
);
void
affine_transform
(
tensor
&
dest
,
const
tensor
&
src1
,
const
tensor
&
src2
,
const
float
A
,
const
float
B
);
void
affine_transform
(
tensor
&
dest
,
const
tensor
&
src1
,
...
...
This diff is collapsed.
Click to expand it.
dlib/dnn/tensor_tools.cpp
View file @
d3f12d83
...
...
@@ -176,6 +176,19 @@ namespace dlib { namespace tt
#endif
}
void
affine_transform
(
tensor
&
dest
,
const
tensor
&
src
,
const
float
A
)
{
#ifdef DLIB_USE_CUDA
cuda
::
affine_transform
(
dest
,
src
,
A
);
#else
cpu
::
affine_transform
(
dest
,
src
,
A
,
0
);
#endif
}
void
affine_transform
(
tensor
&
dest
,
const
tensor
&
src1
,
...
...
@@ -192,6 +205,21 @@ namespace dlib { namespace tt
#endif
}
void
affine_transform
(
tensor
&
dest
,
const
tensor
&
src1
,
const
tensor
&
src2
,
const
float
A
,
const
float
B
)
{
#ifdef DLIB_USE_CUDA
cuda
::
affine_transform
(
dest
,
src1
,
src2
,
A
,
B
);
#else
cpu
::
affine_transform
(
dest
,
src1
,
src2
,
A
,
B
,
0
);
#endif
}
void
affine_transform
(
tensor
&
dest
,
const
tensor
&
src1
,
...
...
This diff is collapsed.
Click to expand it.
dlib/dnn/tensor_tools.h
View file @
d3f12d83
...
...
@@ -168,6 +168,18 @@ namespace dlib { namespace tt
- #dest == A*src + B
!*/
void
affine_transform
(
tensor
&
dest
,
const
tensor
&
src
,
const
float
A
);
/*!
requires
- dest.size()==src.size()
ensures
- #dest == A*src
!*/
void
affine_transform
(
tensor
&
dest
,
const
tensor
&
src1
,
...
...
@@ -181,7 +193,22 @@ namespace dlib { namespace tt
- dest.size()==src1.size()
- dest.size()==src2.size()
ensures
- #dest == A*src1 + src2*B + C
- #dest == A*src1 + B*src2 + C
!*/
void
affine_transform
(
tensor
&
dest
,
const
tensor
&
src1
,
const
tensor
&
src2
,
const
float
A
,
const
float
B
);
/*!
requires
- dest.size()==src1.size()
- dest.size()==src2.size()
ensures
- #dest == A*src1 + B*src2
!*/
void
affine_transform
(
...
...
@@ -195,12 +222,11 @@ namespace dlib { namespace tt
const
float
D
);
/*!
requires
- dest.size()==src1.size()
requires - dest.size()==src1.size()
- dest.size()==src2.size()
- dest.size()==src3.size()
ensures
- #dest == A*src1 +
src2*B + src3*C
+ D
- #dest == A*src1 +
B*src2 + C*src3
+ D
!*/
// ----------------------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment