Sha256: d22657e21d13199fd40568d10b58a6784858bb5c6c479ce71141ee536cf462e0
Contents?: true
Size: 540 Bytes
Versions: 9
Compression:
Stored size: 540 Bytes
Contents
module Torch module Utils module Data class DataLoader include Enumerable attr_reader :dataset def initialize(dataset, batch_size: 1) @dataset = dataset @batch_size = batch_size end def each size.times do |i| start_index = i * @batch_size yield @dataset[start_index...(start_index + @batch_size)] end end def size (@dataset.size / @batch_size.to_f).ceil end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems