An example of the official website gives an error


#1

class MultiIter:
def init(self, iter_list):
self.iters = iter_list
def next(self):
batches = [i.next() for i in self.iters]
return DataBatch(data=[*b.data for b in batches], #error
label=[*b.label for b in batches])
def reset(self):
for i in self.iters:
i.reset()
@property
def provide_data(self):
return [*i.provide_data for i in self.iters] #error
@property
def provide_label(self):
return [*i.provide_label for i in self.iters]

iter = MultiIter([mx.io.ImageRecordIter(‘image.rec’), mx.io.CSVIter(‘txt.csv’)])

the error: iterable unpacking cannot be used in comprehension

how to fix it?


#2

Opening two threads with the same text won’t help to get answers quicker. Also, code blocks should be proper formatted as code, to make it easier to read


#3