mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
PEP585 update - .ci android aten (#145177)
See #145101 for details. Pull Request resolved: https://github.com/pytorch/pytorch/pull/145177 Approved by: https://github.com/Skylion007
This commit is contained in:
committed by
PyTorch MergeBot
parent
00ffeca1b1
commit
b5655d9821
@ -1,4 +1,4 @@
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
from typing import Optional
|
||||
|
||||
import torch
|
||||
from torch import Tensor
|
||||
@ -44,33 +44,33 @@ class Test(torch.jit.ScriptModule):
|
||||
return input
|
||||
|
||||
@torch.jit.script_method
|
||||
def eqDictStrKeyIntValue(self, input: Dict[str, int]) -> Dict[str, int]:
|
||||
def eqDictStrKeyIntValue(self, input: dict[str, int]) -> dict[str, int]:
|
||||
return input
|
||||
|
||||
@torch.jit.script_method
|
||||
def eqDictIntKeyIntValue(self, input: Dict[int, int]) -> Dict[int, int]:
|
||||
def eqDictIntKeyIntValue(self, input: dict[int, int]) -> dict[int, int]:
|
||||
return input
|
||||
|
||||
@torch.jit.script_method
|
||||
def eqDictFloatKeyIntValue(self, input: Dict[float, int]) -> Dict[float, int]:
|
||||
def eqDictFloatKeyIntValue(self, input: dict[float, int]) -> dict[float, int]:
|
||||
return input
|
||||
|
||||
@torch.jit.script_method
|
||||
def listIntSumReturnTuple(self, input: List[int]) -> Tuple[List[int], int]:
|
||||
def listIntSumReturnTuple(self, input: list[int]) -> tuple[list[int], int]:
|
||||
sum = 0
|
||||
for x in input:
|
||||
sum += x
|
||||
return (input, sum)
|
||||
|
||||
@torch.jit.script_method
|
||||
def listBoolConjunction(self, input: List[bool]) -> bool:
|
||||
def listBoolConjunction(self, input: list[bool]) -> bool:
|
||||
res = True
|
||||
for x in input:
|
||||
res = res and x
|
||||
return res
|
||||
|
||||
@torch.jit.script_method
|
||||
def listBoolDisjunction(self, input: List[bool]) -> bool:
|
||||
def listBoolDisjunction(self, input: list[bool]) -> bool:
|
||||
res = False
|
||||
for x in input:
|
||||
res = res or x
|
||||
@ -78,8 +78,8 @@ class Test(torch.jit.ScriptModule):
|
||||
|
||||
@torch.jit.script_method
|
||||
def tupleIntSumReturnTuple(
|
||||
self, input: Tuple[int, int, int]
|
||||
) -> Tuple[Tuple[int, int, int], int]:
|
||||
self, input: tuple[int, int, int]
|
||||
) -> tuple[tuple[int, int, int], int]:
|
||||
sum = 0
|
||||
for x in input:
|
||||
sum += x
|
||||
@ -104,7 +104,7 @@ class Test(torch.jit.ScriptModule):
|
||||
return torch.tensor([int(input.item())])[0]
|
||||
|
||||
@torch.jit.script_method
|
||||
def testAliasWithOffset(self) -> List[Tensor]:
|
||||
def testAliasWithOffset(self) -> list[Tensor]:
|
||||
x = torch.tensor([100, 200])
|
||||
a = [x[0], x[1]]
|
||||
return a
|
||||
|
Reference in New Issue
Block a user