Open petrbel opened 8 years ago
It looks like a bug. So, the reason for it is that the get_data
is called twice, right?
@dmitriy-serdyuk exactly, in this case twice. Originally I had multiple following split-merges which caused that get_data
was called even more than twice.
Is it possible just to copy the request iterator? It should be sufficient.
And can you add a test?
The flag introduced in this commit could be used to split a stream into multiple ones and use each branch independently.
AbstractDataStream
now accepts an optional flagcopy
which isFalse
by default. When set toTrue
, theDataIterator
in theAbstractDataStream.get_epoch_iterator
is always provided with a unique deep copy of the data stream.In addition,
Merge
now accepts and forwards**kwargs
toAbstractDataStream
for compatibility reasons.The following code demonstrates the unexpected behavior which could be avoided by using the
copy=True
flag. The code splits a stream of two variables into two independent streams. Then the streams are merged back into a single stream again. An expected behavior is that the resulting stream generates the same data as the original stream. However, this is not the case.