Hi,
My dataset consists of 192 one-hot encoded feature-bits that I have compressed to 24 bytes. The entire compressed feature-set is loaded in RAM as a ByteArray. The labels are loaded in RAM as a floating-point array. I have defined a generator function to batch uncompress the features and associate them with the labels:
genTrain =
Function[<|
"Input" ->
Map[Flatten,
IntegerDigits[
ArrayReshape[
Normal[trainfeatures[[(#Round - 1)* 24 * #BatchSize +
1 ;; #Round * 24 * #BatchSize ]]], {#BatchSize, 24}], 2,
8]], "Output" ->
trainlabels[[(#Round - 1) * #BatchSize +
1 ;; #Round * #BatchSize ]]|>]
When I now train a network with this generator function:
ntrain = 100
npack = 24
trainfeatures =
ByteArray[Table[RandomInteger[{0, 255}], npack*ntrain]]
trainlabels = Table[RandomReal[{0.0, 1.0}], ntrain]
batchsize = 10
roundlength = Length[trainfeatures]/ (npack * batchsize)
trained =
NetTrain[net, {genTrain, "RoundLength" -> roundlength}, All,
BatchSize -> batchsize, TargetDevice -> "GPU"]
I get the error: 'Cannot take positions 2401 through 2640 in ByteArray'. Clearly NetTrain asks for batch 11 which does not exist, even if I change "RoundLength" to 1. What am I doing wrong? Perhaps I misinterpreted the use of RoundLength and Round?
Regards, GW