Class AsyncDataSetIterator

    • Constructor Detail

      • AsyncDataSetIterator

        protected AsyncDataSetIterator()
      • AsyncDataSetIterator

        public AsyncDataSetIterator​(DataSetIterator baseIterator)
        Create an Async iterator with the default queue size of 8
        Parameters:
        baseIterator - Underlying iterator to wrap and fetch asynchronously from
      • AsyncDataSetIterator

        public AsyncDataSetIterator​(DataSetIterator iterator,
                                    int queueSize,
                                    BlockingQueue<DataSet> queue)
        Create an Async iterator with the default queue size of 8
        Parameters:
        iterator - Underlying iterator to wrap and fetch asynchronously from
        queue - Queue size - number of iterators to
      • AsyncDataSetIterator

        public AsyncDataSetIterator​(DataSetIterator baseIterator,
                                    int queueSize)
      • AsyncDataSetIterator

        public AsyncDataSetIterator​(DataSetIterator baseIterator,
                                    int queueSize,
                                    boolean useWorkspace)
      • AsyncDataSetIterator

        public AsyncDataSetIterator​(DataSetIterator baseIterator,
                                    int queueSize,
                                    boolean useWorkspace,
                                    Integer deviceId)
      • AsyncDataSetIterator

        public AsyncDataSetIterator​(DataSetIterator baseIterator,
                                    int queueSize,
                                    boolean useWorkspace,
                                    DataSetCallback callback)
    • Method Detail

      • next

        public DataSet next​(int num)
        Like the standard next method but allows a customizable number of examples returned
        Specified by:
        next in interface DataSetIterator
        Parameters:
        num - the number of examples
        Returns:
        the next data applyTransformToDestination
      • inputColumns

        public int inputColumns()
        Input columns for the dataset
        Specified by:
        inputColumns in interface DataSetIterator
        Returns:
      • totalOutcomes

        public int totalOutcomes()
        The number of labels for the dataset
        Specified by:
        totalOutcomes in interface DataSetIterator
        Returns:
      • resetSupported

        public boolean resetSupported()
        Is resetting supported by this DataSetIterator? Many DataSetIterators do support resetting, but some don't
        Specified by:
        resetSupported in interface DataSetIterator
        Returns:
        true if reset method is supported; false otherwise
      • asyncSupported

        public boolean asyncSupported()
        Does this DataSetIterator support asynchronous prefetching of multiple DataSet objects? Most DataSetIterators do, but in some cases it may not make sense to wrap this iterator in an iterator that does asynchronous prefetching. For example, it would not make sense to use asynchronous prefetching for the following types of iterators: (a) Iterators that store their full contents in memory already (b) Iterators that re-use features/labels arrays (as future next() calls will overwrite past contents) (c) Iterators that already implement some level of asynchronous prefetching (d) Iterators that may return different data depending on when the next() method is called
        Specified by:
        asyncSupported in interface DataSetIterator
        Returns:
        true if asynchronous prefetching from this iterator is OK; false if asynchronous prefetching should not be used with this iterator
      • externalCall

        protected void externalCall()
      • reset

        public void reset()
        Resets the iterator back to the beginning
        Specified by:
        reset in interface DataSetIterator
      • shutdown

        public void shutdown()
        This method will terminate background thread AND will destroy attached workspace (if any) PLEASE NOTE: After shutdown() call, this instance can't be used anymore
      • hasNext

        public boolean hasNext()
        Returns true if the iteration has more elements. (In other words, returns true if next(int) would return an element rather than throwing an exception.)
        Specified by:
        hasNext in interface Iterator<DataSet>
        Returns:
        true if the iteration has more elements
      • next

        public DataSet next()
        Returns the next element in the iteration.
        Specified by:
        next in interface Iterator<DataSet>
        Returns:
        the next element in the iteration
      • remove

        public void remove()
        Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next(int). The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.
        Specified by:
        remove in interface Iterator<DataSet>
        Throws:
        UnsupportedOperationException - if the remove operation is not supported by this iterator
        IllegalStateException - if the next method has not yet been called, or the remove method has already been called after the last call to the next method