class MXNet::Gluon::Data::BatchSampler(T)
Overview
Wraps another Sampler and returns mini-batches of samples.
sampler = MXNet::Gluon::Data::BatchSampler.new(
  MXNet::Gluon::Data::SequentialSampler.new(10), 3, :keep
)
sampler.to_a # => [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]
  Included Modules
- Iterator(Array(T))
 
Defined in:
mxnet/gluon/data/sampler.crConstructors
- 
        .new(sampler : Sampler(T), batch_size : Int32, last_batch = :keep)
        
          
Creates a new instance.
 
Instance Method Summary
- 
        #next
        
          
Returns the next element in the sequence, or
Iterator::Stop::INSTANCEif there are no more elements. - 
        #rewind
        
          
Rewinds the sequence.
 - 
        #size
        
          
Returns the number of elements in the sequence.
 
Instance methods inherited from class MXNet::Gluon::Data::Sampler(Array(T))
  
  
    
      each(&block : T(T) -> _)each each, size size
Constructor Detail
Creates a new instance.
Parameters
- sampler (
Sampler) The source sampler. - batch_size (
Int32) Size of mini-batches. - last_batch (
:keep,:discard,:rollover) Specifies how the last batch is handled ifbatch_sizedoes not evenly divide sampler sequence size. If:keep, the last batch will be returned directly, but will contain fewer elements thanbatch_sizerequires. If:discard, the last batch will be discarded. If:rollover, the remaining elements will be rolled over to the next iteration. 
Instance Method Detail
        
        def next
        #
      
      
        Returns the next element in the sequence, or
Iterator::Stop::INSTANCE if there are no more elements.
        
        def rewind
        #
      
      
        Rewinds the sequence.
If the source sampler is a BatchSampler, this rewinds it
as well.