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
apex
Commits
ceca097f
"vscode:/vscode.git/clone" did not exist on "8ff870bf3e6a87d2b12d4d01820c0e86de194664"
Unverified
Commit
ceca097f
authored
Jun 15, 2020
by
Asit
Committed by
GitHub
Jun 15, 2020
Browse files
editing comments
parent
02a33875
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
apex/contrib/sparsity/asp.py
apex/contrib/sparsity/asp.py
+2
-2
No files found.
apex/contrib/sparsity/asp.py
View file @
ceca097f
...
@@ -6,7 +6,7 @@ torchvision_imported=True
...
@@ -6,7 +6,7 @@ torchvision_imported=True
try
:
try
:
import
torchvision
import
torchvision
except
ImportError
:
except
ImportError
:
print
(
"[ASP][Warning] torchvision cannot be imported
, may infuence functionality of MaskRCNN/KeypointRCNN network from torchvision
."
)
print
(
"[ASP][Warning] torchvision cannot be imported."
)
torchvision_imported
=
False
torchvision_imported
=
False
def
eligible_modules
(
model
,
whitelist_layer_types
,
allowed_layer_names
,
disallowed_layer_names
):
def
eligible_modules
(
model
,
whitelist_layer_types
,
allowed_layer_names
,
disallowed_layer_names
):
...
@@ -78,7 +78,7 @@ class ASP:
...
@@ -78,7 +78,7 @@ class ASP:
# function to extract variables that will be sparsified.
# function to extract variables that will be sparsified.
# idea is that you will add one of these functions for each module type that can be sparsified.
# idea is that you will add one of these functions for each module type that can be sparsified.
if
torchvision_imported
:
if
torchvision_imported
:
print
(
"[ASP] torchvision is imported, can work
smoothly
with the MaskRCNN/KeypointRCNN from torchvision."
)
print
(
"[ASP] torchvision is imported, can work with the MaskRCNN/KeypointRCNN from torchvision."
)
sparse_parameter_list
=
{
torch
.
nn
.
Linear
:
[
'weight'
],
torch
.
nn
.
Conv1d
:
[
'weight'
],
torch
.
nn
.
Conv2d
:
[
'weight'
],
torch
.
nn
.
Conv3d
:
[
'weight'
],
torchvision
.
ops
.
misc
.
Conv2d
:
[
'weight'
]}
sparse_parameter_list
=
{
torch
.
nn
.
Linear
:
[
'weight'
],
torch
.
nn
.
Conv1d
:
[
'weight'
],
torch
.
nn
.
Conv2d
:
[
'weight'
],
torch
.
nn
.
Conv3d
:
[
'weight'
],
torchvision
.
ops
.
misc
.
Conv2d
:
[
'weight'
]}
else
:
else
:
sparse_parameter_list
=
{
torch
.
nn
.
Linear
:
[
'weight'
],
torch
.
nn
.
Conv1d
:
[
'weight'
],
torch
.
nn
.
Conv2d
:
[
'weight'
],
torch
.
nn
.
Conv3d
:
[
'weight'
]}
sparse_parameter_list
=
{
torch
.
nn
.
Linear
:
[
'weight'
],
torch
.
nn
.
Conv1d
:
[
'weight'
],
torch
.
nn
.
Conv2d
:
[
'weight'
],
torch
.
nn
.
Conv3d
:
[
'weight'
]}
...
...
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