mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Revert D25717504: Clean up some type annotations in test/jit
Test Plan: revert-hammer
Differential Revision:
D25717504 (a4f30d48d8
)
Original commit changeset: 9a83c44db02e
fbshipit-source-id: e6e3a83bed22701d8125f5a293dfcd5093c1a2cd
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f9f758e349
commit
1bb7d8ff93
@ -2,7 +2,7 @@ import os
|
||||
import sys
|
||||
import inspect
|
||||
import unittest
|
||||
from typing import Dict, List
|
||||
from typing import List
|
||||
|
||||
import torch
|
||||
|
||||
@ -78,7 +78,8 @@ class TestBuiltins(JitTestCase):
|
||||
torch.jit.script(Mod())
|
||||
|
||||
def test_del(self):
|
||||
def fn(x: List[int]) -> List[int]:
|
||||
def fn(x):
|
||||
# type: (List[int]) -> List[int]
|
||||
a = x * 2
|
||||
del a
|
||||
return x
|
||||
@ -108,14 +109,16 @@ class TestBuiltins(JitTestCase):
|
||||
return a
|
||||
|
||||
def test_del_multiple_operands(self):
|
||||
def fn(x: List[int]) -> List[int]:
|
||||
def fn(x):
|
||||
# type: (List[int]) -> List[int]
|
||||
a, b, c = x[0], x[1], x[2]
|
||||
del a, b, c
|
||||
return x
|
||||
|
||||
self.checkScript(fn, ([1, 2, 3],))
|
||||
|
||||
def del_list_multiple_operands(x: List[int]) -> List[int]:
|
||||
def del_list_multiple_operands(x):
|
||||
# type: (List[int]) -> List[int]
|
||||
del x[0], x[1]
|
||||
return x
|
||||
|
||||
@ -123,7 +126,8 @@ class TestBuiltins(JitTestCase):
|
||||
jit_out = torch.jit.script(del_list_multiple_operands)([0, 1, 2])
|
||||
self.assertEquals(py_out, jit_out)
|
||||
|
||||
def del_dict_multiple_operands(x: Dict[str, int]) -> Dict[str, int]:
|
||||
def del_dict_multiple_operands(x):
|
||||
# type: (Dict[str, int]) -> Dict[str, int]
|
||||
del x['hi'], x['there']
|
||||
return x
|
||||
|
||||
|
Reference in New Issue
Block a user