mirror of https://github.com/davisking/dlib.git
Made a tensor iterable
This commit is contained in:
parent
00e18a8d59
commit
9cbbe7b75b
|
@ -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();
|
||||||
|
|
|
@ -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;
|
||||||
/*!
|
/*!
|
||||||
|
|
Loading…
Reference in New Issue