!30538 fix scipy st utils to creat_sys_pos_martix

Merge pull request !30538 from zhuzhongrui/pub_master2
This commit is contained in:
i-robot 2022-02-25 01:29:16 +00:00 committed by Gitee
commit 2dbb931663
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 2 additions and 2 deletions

View File

@ -94,8 +94,8 @@ def create_sym_pos_matrix(shape, dtype):
'Symmetric positive definite matrix must be a square matrix, but has shape: ', shape)
n = shape[-1]
a = (onp.random.random(shape) + onp.eye(n)).astype(dtype)
return onp.dot(a, a.T)
x = onp.random.random(shape)
return (onp.matmul(x, x.T) + onp.eye(n)).astype(dtype)
def gradient_check(x, net, epsilon=1e-3, enumerate_fn=onp.ndenumerate):