提交 dd3548dd 编写于 作者: H hanhuifeng2020

fix a bug that apply_adagrad test case run failed

上级 fb7d8d6c
......@@ -34,8 +34,9 @@ def apply_adagrad_execute(shape, dtype, update_slots, attrs=None):
def gen_data(dtype, update_slots, shape):
var = random_gaussian(shape, miu=1, sigma=0.1).astype(dtype)
# accum must be greater than or equal to 0
accum = np.abs(random_gaussian(shape, miu=1, sigma=0.1).astype(dtype))
# accum must be greater than 0
epsilon = 1e-7 if dtype == np.float32 else 1e-3
accum = np.abs(random_gaussian(shape, miu=1, sigma=0.1).astype(dtype)) + epsilon
lr = random_gaussian((1,), miu=1, sigma=0.1).astype(dtype)
grad = random_gaussian(shape, miu=1, sigma=0.1).astype(dtype)
inputs = [var, accum, lr, grad]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册