Created by: zhiqiu
This PR patches math methods, like +, -, *, /
, for VarBase, and the patched methods will auto-generated op functions, as described in PR21569.
Sample code.
import paddle.fluid as fluid
import numpy as np
a_np = np.asarray([3])
b_np = np.asarray([1])
place = fluid.CUDAPlace(0)
with fluid.dygraph.guard(place):
a = fluid.dygraph.to_variable(a_np)
b = fluid.dygraph.to_variable(b_np)
res = a * b
print(res.numpy()) # [3]