Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
d3e3d71b
Unverified
Commit
d3e3d71b
authored
May 16, 2022
by
Yuge Zhang
Committed by
GitHub
May 16, 2022
Browse files
Fix typehint of make divisible (#4862)
parent
c8d1ed9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
nni/retiarii/hub/pytorch/proxylessnas.py
nni/retiarii/hub/pytorch/proxylessnas.py
+12
-2
No files found.
nni/retiarii/hub/pytorch/proxylessnas.py
View file @
d3e3d71b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# Licensed under the MIT license.
# Licensed under the MIT license.
import
math
import
math
from
typing
import
Optional
,
Callable
,
List
,
Tuple
,
Iterator
,
cast
from
typing
import
Optional
,
Callable
,
List
,
Tuple
,
Iterator
,
Union
,
cast
,
overload
import
torch
import
torch
import
nni.retiarii.nn.pytorch
as
nn
import
nni.retiarii.nn.pytorch
as
nn
...
@@ -12,7 +12,17 @@ from .utils.fixed import FixedFactory
...
@@ -12,7 +12,17 @@ from .utils.fixed import FixedFactory
from
.utils.pretrained
import
load_pretrained_weight
from
.utils.pretrained
import
load_pretrained_weight
def
make_divisible
(
v
,
divisor
,
min_val
=
None
):
@
overload
def
make_divisible
(
v
:
Union
[
int
,
float
],
divisor
,
min_val
=
None
)
->
int
:
...
@
overload
def
make_divisible
(
v
:
Union
[
nn
.
ChoiceOf
[
int
],
nn
.
ChoiceOf
[
float
]],
divisor
,
min_val
=
None
)
->
nn
.
ChoiceOf
[
int
]:
...
def
make_divisible
(
v
:
Union
[
nn
.
ChoiceOf
[
int
],
nn
.
ChoiceOf
[
float
],
int
,
float
],
divisor
,
min_val
=
None
)
->
nn
.
MaybeChoice
[
int
]:
"""
"""
This function is taken from the original tf repo.
This function is taken from the original tf repo.
It ensures that all layers have a channel number that is divisible by 8
It ensures that all layers have a channel number that is divisible by 8
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment