CM
06/21/2021, 3:57 PMKevin Kho
06/21/2021, 4:09 PMList[Tuple]
back like [(‘A’, ‘a’, ‘Aa’), (‘A’, ‘a’, ‘Aa’), (‘A’, ‘a’, ‘Aa’), …] . v1, v2, v3 = taskA()
assumes a Tuple[List]
type structure where you’re expecting v1, v2, and v3 to be lists. You need an intermediate task here to reshape the List[Tuple]
to Tuple[List]
type of structure@task(nout=3)
def reshape(x: List[Tuple]) -> Tuple[List]:
out1 = [_[0] for _ in x]
out2 = [_[1] for _ in x]
out3 = [_[2] for _ in x]
return out1, out2, out3
CM
06/21/2021, 4:49 PMKevin Kho
06/21/2021, 4:52 PMCM
06/21/2021, 4:54 PMKevin Kho
06/21/2021, 4:55 PMflatten
or unmapped
to lessen the memory footprint, but I wouldn’t be 100% sure this is possible from this simple example. Looking at this simple example though, if 'A', 'a', 'Aa'
are constant throughout the next mapping operation, you can pass the list as unmapped
instead so you don’t have to perform the first map