From 137afb7ea206136fce923af44216c656f91655ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:46:49 -0800 Subject: [PATCH 1/2] chore(deps): bump actions/deploy-pages from 2 to 3 (#1201) --- .github/workflows/pages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml index 857929f12..6527e456c 100644 --- a/.github/workflows/pages.yaml +++ b/.github/workflows/pages.yaml @@ -47,4 +47,4 @@ jobs: path: 'dist/html' - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v3 From 036b6478c7cdef0b5fdee4f564eef9c8d450002c Mon Sep 17 00:00:00 2001 From: Ti-Tai Wang Date: Fri, 8 Dec 2023 19:29:40 -0800 Subject: [PATCH 2/2] Fix Op(aten::diagonal) | feat(torchlib) (#1209) dim1 and dim2 could go negative. --- onnxscript/function_libs/torch_lib/ops/core.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/onnxscript/function_libs/torch_lib/ops/core.py b/onnxscript/function_libs/torch_lib/ops/core.py index bfd1dc205..999d9dffb 100644 --- a/onnxscript/function_libs/torch_lib/ops/core.py +++ b/onnxscript/function_libs/torch_lib/ops/core.py @@ -2440,6 +2440,11 @@ def aten_diagonal(self: TReal, offset: int = 0, dim1: int = 0, dim2: int = 1) -> # [0,1,2] -> [2,0,1] when dim1=0 and dim2=1 # [0,1,2] -> [1,0,2] when dim1=0 and dim2=2 # [0,1,2] -> [0,1,2] when dim1=1 and dim2=2 + if dim1 < 0: + dim1 = dim1 + len(self.shape) + if dim2 < 0: + dim2 = dim2 + len(self.shape) + self_rank = len(self.shape) perm = list(range(self_rank)) perm.remove(dim1) @@ -2514,6 +2519,11 @@ def aten_diagonal_bool(self: BOOL, offset: int = 0, dim1: int = 0, dim2: int = 1 # [0,1,2] -> [2,0,1] when dim1=0 and dim2=1 # [0,1,2] -> [1,0,2] when dim1=0 and dim2=2 # [0,1,2] -> [0,1,2] when dim1=1 and dim2=2 + if dim1 < 0: + dim1 = dim1 + len(self.shape) + if dim2 < 0: + dim2 = dim2 + len(self.shape) + self_rank = len(self.shape) perm = list(range(self_rank)) perm.remove(dim1)