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
8d2215be
"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "e861793ab710f7a617225610d52c20c339c8def6"
Unverified
Commit
8d2215be
authored
Dec 29, 2021
by
dosemeion
Committed by
GitHub
Dec 29, 2021
Browse files
add pathlib (#4395)
parent
3935a099
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
nni/compression/pytorch/speedup/compressor.py
nni/compression/pytorch/speedup/compressor.py
+6
-4
No files found.
nni/compression/pytorch/speedup/compressor.py
View file @
8d2215be
# Copyright (c) Microsoft Corporation.
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# Licensed under the MIT license.
import
os
import
queue
import
logging
import
copy
import
copy
import
logging
from
pathlib
import
Path
import
queue
import
torch
import
torch
import
torch.nn
as
nn
import
torch.nn
as
nn
...
@@ -63,7 +65,7 @@ class ModelSpeedup:
...
@@ -63,7 +65,7 @@ class ModelSpeedup:
# load the mask tensor to the same device with the dummy_input
# load the mask tensor to the same device with the dummy_input
# self.masks save the mask tensors pruned by the user and the infered
# self.masks save the mask tensors pruned by the user and the infered
# masks of the others modules
# masks of the others modules
if
isinstance
(
masks_file
,
str
)
and
os
.
path
.
exists
(
masks_file
):
if
isinstance
(
masks_file
,
(
str
,
Path
))
and
Path
(
masks_file
)
.
exists
()
:
self
.
masks
=
torch
.
load
(
self
.
masks
=
torch
.
load
(
masks_file
,
map_location
if
map_location
is
not
None
else
str
(
self
.
device
))
masks_file
,
map_location
if
map_location
is
not
None
else
str
(
self
.
device
))
elif
isinstance
(
masks_file
,
dict
):
elif
isinstance
(
masks_file
,
dict
):
...
...
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