Caffe2 - C++ API
A deep learning, cross platform ML framework
Public Types | Public Member Functions | Data Fields
torch::data::detail::ValidIterator< Batch > Struct Template Reference
Inheritance diagram for torch::data::detail::ValidIterator< Batch >:
torch::data::detail::IteratorImpl< Batch >

Public Types

using BatchProducer = std::function< optional< Batch >()>
 

Public Member Functions

 ValidIterator (BatchProducer next_batch)
 
void next () override
 Fetches the next batch.
 
Batch & get () override
 Returns the current batch. More...
 
bool operator== (const IteratorImpl< Batch > &other) const override
 Does double dispatch.
 
bool operator== (const SentinelIterator< Batch > &) const override
 A ValidIterator is equal to the SentinelIterator iff. More...
 
bool operator== (const ValidIterator< Batch > &other) const override
 Returns true if the memory address of other equals that of this.
 
void lazy_initialize () const
 Gets the very first batch if it has not yet been fetched.
 

Data Fields

BatchProducer next_batch_
 
optional< Batch > batch_
 
bool initialized_ = false
 

Detailed Description

template<typename Batch>
struct torch::data::detail::ValidIterator< Batch >

Definition at line 26 of file iterator.h.

Member Function Documentation

template<typename Batch>
Batch& torch::data::detail::ValidIterator< Batch >::get ( )
inlineoverridevirtual

Returns the current batch.

The precondition for this operation to not throw an exception is that it has been compared to the SentinelIterator and did not compare equal.

Implements torch::data::detail::IteratorImpl< Batch >.

Definition at line 62 of file iterator.h.

template<typename Batch>
bool torch::data::detail::ValidIterator< Batch >::operator== ( const SentinelIterator< Batch > &  ) const
inlineoverridevirtual

A ValidIterator is equal to the SentinelIterator iff.

the ValidIterator has reached the end of the dataloader.

Implements torch::data::detail::IteratorImpl< Batch >.

Definition at line 78 of file iterator.h.


The documentation for this struct was generated from the following file: