|
def clone(self): |
|
p = Program() |
|
p.desc = core.ProgramDesc(self.desc) |
|
p.blocks = [Block(p, i) for i in xrange(self.desc.num_blocks())] |
|
p.sync_with_cpp() |
|
return p |
The Program.clone only clone the variables and ops in the program into a new program. However, the information of Parameter is not clone.
So we need restore the information of Parameters.