Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
9cbbe7b7
You need to sign in or sign up before continuing.
Commit
9cbbe7b7
authored
Nov 09, 2015
by
Davis King
Browse files
Made a tensor iterable
parent
00e18a8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
dlib/dnn/tensor.h
dlib/dnn/tensor.h
+7
-0
dlib/dnn/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