Created by: panyx0718
Note: It happens sometime that the program's graph is not fully connected. For example, when using ParallelExecutor for test, the graph is sharded. Just add this helper for future use.
test=develop