Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Got stuck in getBatch with larger batch size #21

@joeyhng

Description

@joeyhng

The following code reproduce the error:

local Dataset = require 'dataset.Dataset'

local opt = lapp[[
Got stuck in torch-dataset with batchSize == 128

(options)
   --batchSize     (default 128)    how many images in a mini-batch?
]]

-- create tmp csv file containing lots of rows
local tmpcsv = paths.tmpname() .. '.csv'
f = io.open(tmpcsv, 'w')
f:write('filename\n')
for i=1,300 do
  f:write(paths.tmpname() .. '\n')
end
f:close()

dataset = Dataset(tmpcsv)

getBatch, numBatches, reset = dataset.sampledBatcher({
  batchSize = opt.batchSize,
  inputDims = {10, 256},
  verbose = true,
  poolSize = 4,
  get = function(x)
    return torch.FloatTensor(10,256)
  end,
  processor = function(res, processorOpt, input) 
    return true
  end,
})

print('before getBatch')
local batch = getBatch()
print('finish getBatch')

Strangely the program works when batchSize is 64, but got stuck in getBatch() when batchSize is 128.

I came across this problem for several different problems which use custom get function and load data with other non-default method like image.load, where batchSize 64 works but not 128.

Any idea is appreciated. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions