Fix the OpDesc construction in BlockDesc constructor
Created by: kexinzhao
The code above is how the OpDesc is constructed when we call program.clone() on the python side. This construction will call the following function: https://github.com/PaddlePaddle/Paddle/blob/b15c675530db541440ddb5b7e774d522ecaf1533/paddle/framework/op_desc.h#L39-L42
Essentially, this calls a default assignment operator that copies the following data members: https://github.com/PaddlePaddle/Paddle/blob/b15c675530db541440ddb5b7e774d522ecaf1533/paddle/framework/op_desc.h#L141-L147
Because the attribute type in the AttributeMap could be a BlockDesc*
, cloning program desc in this way, makes for example the BLOCK attribute of the while
operator in the copied program desc points to a BlockDesc in the original program desc.
This will be fixed along with #8161 (closed)