Skip to content

Commit 0f4e1ee

Browse files
authored
Add mypy.ini and fix typing error (#41)
Signed-off-by: Hao Wu <[email protected]>
1 parent e1a8def commit 0f4e1ee

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

emerging_optimizers/utils/eig.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def eig_orthogonal_iteration(
140140
Q = approx_eigenvectors
141141
approx_eigvals = conjugate(x, Q, diag=True)
142142
iteration = 0
143+
sorted_approx_eigvals: Tensor = approx_eigvals
143144
while iteration < max_iterations and not met_approx_eigvals_criteria(x, approx_eigvals, tolerance):
144145
power_iteration = x @ Q
145146
Q = torch.linalg.qr(power_iteration).Q

mypy.ini

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[mypy]
2+
cache_dir = .mypy_cache/normal
3+
allow_redefinition = True
4+
warn_unused_configs = True
5+
warn_redundant_casts = True
6+
show_error_codes = True
7+
show_column_numbers = True
8+
check_untyped_defs = True
9+
disallow_untyped_defs = True
10+
disallow_untyped_decorators = True
11+
follow_imports = normal
12+
local_partial_types = True
13+
enable_error_code = possibly-undefined
14+
15+
# do not reenable this:
16+
# https://github.com/pytorch/pytorch/pull/60006#issuecomment-866130657
17+
warn_unused_ignores = False
18+
19+
ignore_missing_imports = True
20+
21+
files =
22+
emerging_optimizers,
23+
24+
25+
exclude = ^docs

0 commit comments

Comments
 (0)