Support repeated device input on last consumer
This MR addresses an issue by which if the last algorithm in the generated sequence was using a repeated device input (ie. the same object provenance twice), the memory manager would get confused trying to free twice the same tag. The solution proposed here is to make "outdependencies" of each algorithm a set by removing repeated elements.