From f632ec0956cf88f6c475660bbab3f607a6d34c1c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 12 Oct 2023 11:33:33 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- benchmark/ops/softmax.py | 7 +++---- pyg_lib/ops/__init__.py | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/benchmark/ops/softmax.py b/benchmark/ops/softmax.py index be206485b..1905ec60b 100644 --- a/benchmark/ops/softmax.py +++ b/benchmark/ops/softmax.py @@ -1,11 +1,11 @@ import argparse +from time import perf_counter as timestamp import torch -import pyg_lib - -from time import perf_counter as timestamp from torch_geometric.utils import segment +import pyg_lib + def softmax_reference_ptr(src, ptr, dim=0): dim = dim + src.dim() if dim < 0 else dim @@ -66,4 +66,3 @@ def measure_perf(impl_func, ptr, out_grad, num_warmups, num_steps, backward): print(f'pyg_lib forward: {t_fwd:.4f}s') if args.backward: print(f'pyg_lib backward: {t_bwd:.4f}s') - diff --git a/pyg_lib/ops/__init__.py b/pyg_lib/ops/__init__.py index e1a0dff89..ac11dac76 100644 --- a/pyg_lib/ops/__init__.py +++ b/pyg_lib/ops/__init__.py @@ -352,9 +352,8 @@ def forward( @staticmethod def backward(ctx, out_grad: Tensor) -> Tuple[Union[Tensor, int]]: out, index, ptr = ctx.saved_tensors - in_grad = torch.ops.pyg.softmax_backward( - out, out_grad, index, ptr, ctx.num_nodes, ctx.dim - ) + in_grad = torch.ops.pyg.softmax_backward(out, out_grad, index, ptr, + ctx.num_nodes, ctx.dim) return in_grad, None, None, None, None