!48964 fix diagonal window error

Merge pull request !48964 from panfengfeng/fix_diaginal_windows_error
This commit is contained in:
i-robot 2023-02-16 08:01:04 +00:00 committed by Gitee
commit 0189631634
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 1 additions and 1 deletions

View File

@ -6020,7 +6020,7 @@ def diagonal(input, offset=0, dim1=0, dim2=1):
begin = ()
for _ in np.arange((x_ndim - 2)):
begin += (0,)
last_dim_begin = np.max((0, -offset))
last_dim_begin = np.max((0, -offset)).astype(np.int64)
begin += (last_dim_begin,)
res_size = res.shape[:-1]
last_dim_end = np.min((x_shape[-2], np.max((0, (x_shape[-1] - offset))))) - last_dim_begin