mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
[4/N] Apply py39 ruff and pyupgrade fixes (#143257)
```torch/fx/passes/annotate_getitem_nodes.py``` was changed to support the new type hinting annotations. Pull Request resolved: https://github.com/pytorch/pytorch/pull/143257 Approved by: https://github.com/justinchuby, https://github.com/albanD
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
# Owner(s): ["oncall: distributed"]
|
||||
|
||||
import unittest
|
||||
from typing import List, Optional, Tuple
|
||||
from typing import Optional
|
||||
|
||||
import torch
|
||||
import torch.distributed
|
||||
@ -27,9 +27,9 @@ class MyModule(torch.nn.Module):
|
||||
class MyDummyFnOptimizer:
|
||||
def __init__(
|
||||
self,
|
||||
params: List[Tensor],
|
||||
params: list[Tensor],
|
||||
lr: float = 1e-3,
|
||||
betas: Tuple[float, float] = (0.9, 0.999),
|
||||
betas: tuple[float, float] = (0.9, 0.999),
|
||||
eps: float = 1e-6,
|
||||
weight_decay: float = 0.0,
|
||||
_allow_empty_param_list: bool = False,
|
||||
@ -63,7 +63,7 @@ class MyDummyFnOptimizer:
|
||||
"MyDummyFnOptimizer does not support step_param() as of now"
|
||||
)
|
||||
|
||||
def step(self, gradients: List[Optional[Tensor]]):
|
||||
def step(self, gradients: list[Optional[Tensor]]):
|
||||
# call the custom optimizer step implementation
|
||||
with torch.no_grad():
|
||||
raise RuntimeError("MyDummyFnOptimizer does not support step() as of now")
|
||||
|
Reference in New Issue
Block a user