• L
    Check whether there is any inplace operation affecting gradient calculation. (#27901) · 865a4598
    liym27 提交于
    * Add a class TensorInplaceVersion to count the inplace version and put it in framework::Tensor instead of Allocation or Variable.
    
    * Add a new attribute `_inplace_version` for VarBase.
    
    * Raise exception if an inplace operation can result in incorrect gradient computation.
    
    * Add a new interface _bump_inplace_version() for VarBase to bump the version whenever the Tensor is modified through an inplace operation.
    
    * For api assign, call _bump_inplace_version() when it's an inplace operation inn dynamic mode.
    
    * Use original var_wrapper if the inplace_version is not changed.
    
    * Replace SnapshotVarWrapperList with SnapshotVarWrapper to optimize performane.
    865a4598
tensor.py 63.5 KB