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
9cbbe7b7
Commit
9cbbe7b7
authored
Nov 09, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made a tensor iterable
parent
00e18a8d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
tensor.h
dlib/dnn/tensor.h
+7
-0
tensor_abstract.h
dlib/dnn/tensor_abstract.h
+11
-0
No files found.
dlib/dnn/tensor.h
View file @
9cbbe7b7
...
@@ -35,6 +35,13 @@ namespace dlib
...
@@ -35,6 +35,13 @@ namespace dlib
long
nc
()
const
{
return
m_nc
;
}
long
nc
()
const
{
return
m_nc
;
}
size_t
size
()
const
{
return
data
.
size
();
}
size_t
size
()
const
{
return
data
.
size
();
}
typedef
float
*
iterator
;
typedef
const
float
*
const_iterator
;
iterator
begin
()
{
return
host
();
}
const_iterator
begin
()
const
{
return
host
();
}
iterator
end
()
{
return
host
()
+
size
();
}
const_iterator
end
()
const
{
return
host
()
+
size
();
}
void
async_copy_to_device
()
const
void
async_copy_to_device
()
const
{
{
data
.
async_copy_to_device
();
data
.
async_copy_to_device
();
...
...
dlib/dnn/tensor_abstract.h
View file @
9cbbe7b7
...
@@ -98,6 +98,17 @@ namespace dlib
...
@@ -98,6 +98,17 @@ namespace dlib
async_copy_to_device() and then immediately call device().
async_copy_to_device() and then immediately call device().
!*/
!*/
typedef
float
*
iterator
;
typedef
const
float
*
const_iterator
;
iterator
begin
()
{
return
host
();
}
const_iterator
begin
()
const
{
return
host
();
}
iterator
end
()
{
return
host
()
+
size
();
}
const_iterator
end
()
const
{
return
host
()
+
size
();
}
/*!
ensures
- makes a tensor iterable just like the STL containers.
!*/
const
float
*
host
(
const
float
*
host
(
)
const
;
)
const
;
/*!
/*!
...
...
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