Created by: zhiqiu
This PR try to split VarBase from python Variable Wrapper, thus Paddle can use VarBase which is exported from C++ directly in dygraph mode.
The reason to do that includes,
- to decouple
Python side logic
ofdygraph eager execution
withstatic graph
, - to speed up training process by directly accessing C++ VarBase,
- to cooperate with
auto generated OP functions
, which may be introduced in the future.
After this PR, in dygraph mode, all the APIs of Variable
before are indeed of VarBase
. For example,
-
to_variable()
returns aVarBase
object which has the same interface with Variable, -
layers.xx
acceptsVarBase
objects as inputs and returnsVarBase
objects after some operations, -
create_parameter
returns aParamBase
object which is a child object ofVarBase
.
Models evaluation results. (using ptm
with default params in models repo.)
-
Conclusion:
- in dygraph, 8% speed up and no effect on astringency;
- in static graph, no effcet on speed and astringency.