"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "54e55b52d4886d4c63e592310b4253e01c606285"
Unverified Commit 0e402e14 authored by Sergii Dymchenko's avatar Sergii Dymchenko Committed by GitHub
Browse files

Update deprecated `torch.range` in `test_modeling_ibert.py` (#27355)

* Update deprecated torch.range

* Remove comment
parent a5bee89c
...@@ -519,7 +519,7 @@ class IBertModelIntegrationTest(unittest.TestCase): ...@@ -519,7 +519,7 @@ class IBertModelIntegrationTest(unittest.TestCase):
gelu_q = IntGELU(quant_mode=True) gelu_q = IntGELU(quant_mode=True)
gelu_dq = nn.GELU() gelu_dq = nn.GELU()
x_int = torch.range(-10000, 10000, 1) x_int = torch.arange(-10000, 10001, 1)
x_scaling_factor = torch.tensor(0.001) x_scaling_factor = torch.tensor(0.001)
x = x_int * x_scaling_factor x = x_int * x_scaling_factor
...@@ -534,7 +534,7 @@ class IBertModelIntegrationTest(unittest.TestCase): ...@@ -534,7 +534,7 @@ class IBertModelIntegrationTest(unittest.TestCase):
self.assertTrue(torch.allclose(q_int, q_int.round(), atol=1e-4)) self.assertTrue(torch.allclose(q_int, q_int.round(), atol=1e-4))
def test_force_dequant_gelu(self): def test_force_dequant_gelu(self):
x_int = torch.range(-10000, 10000, 1) x_int = torch.arange(-10000, 10001, 1)
x_scaling_factor = torch.tensor(0.001) x_scaling_factor = torch.tensor(0.001)
x = x_int * x_scaling_factor x = x_int * x_scaling_factor
...@@ -565,7 +565,6 @@ class IBertModelIntegrationTest(unittest.TestCase): ...@@ -565,7 +565,6 @@ class IBertModelIntegrationTest(unittest.TestCase):
softmax_q = IntSoftmax(output_bit, quant_mode=True) softmax_q = IntSoftmax(output_bit, quant_mode=True)
softmax_dq = nn.Softmax() softmax_dq = nn.Softmax()
# x_int = torch.range(-10000, 10000, 1)
def _test(array): def _test(array):
x_int = torch.tensor(array) x_int = torch.tensor(array)
x_scaling_factor = torch.tensor(0.1) x_scaling_factor = torch.tensor(0.1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment