Exemplo n.º 1
0
        public (int, ISntPairBatch) GetNextBatch()
        {
            List <List <List <string> > > inputBatchs = new List <List <List <string> > >(); // shape: (feature_group_size, batch_size, sequence_length)

            lock (locker)
            {
                int oldIdx = currentIdx;

                for (int i = 0; i < batchSize && currentIdx < lines.Length; i++, currentIdx++)
                {
                    string line = lines[currentIdx];
                    if (sp != null)
                    {
                        line = sp.Encode(line);
                    }
                    Misc.AppendNewBatch(inputBatchs, line, maxSentLength);
                }

                if (inputBatchs.Count == 0)
                {
                    return(-1, null);
                }

                T batch = new T();
                batch.CreateBatch(inputBatchs, null);

                return(oldIdx, batch);
            }
        }