Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
distiller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
distiller
Commits
cee295fb
Commit
cee295fb
authored
6 years ago
by
Lev Zlotnik
Browse files
Options
Downloads
Patches
Plain Diff
Fix issue #155
parent
7fb41d6f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
distiller/summary_graph.py
+10
-1
10 additions, 1 deletion
distiller/summary_graph.py
with
10 additions
and
1 deletion
distiller/summary_graph.py
+
10
−
1
View file @
cee295fb
...
@@ -83,7 +83,16 @@ class SummaryGraph(object):
...
@@ -83,7 +83,16 @@ class SummaryGraph(object):
def
__init__
(
self
,
model
,
dummy_input
):
def
__init__
(
self
,
model
,
dummy_input
):
model
=
distiller
.
make_non_parallel_copy
(
model
)
model
=
distiller
.
make_non_parallel_copy
(
model
)
with
torch
.
onnx
.
set_training
(
model
,
False
):
with
torch
.
onnx
.
set_training
(
model
,
False
):
trace
,
_
=
jit
.
get_trace_graph
(
model
,
dummy_input
.
cuda
())
def
_tupletree2device
(
obj
,
device
):
if
isinstance
(
obj
,
torch
.
Tensor
):
return
obj
.
to
(
device
)
if
not
isinstance
(
obj
,
tuple
):
raise
TypeError
(
"
obj has to be a tree of tuples.
"
)
return
tuple
(
_tupletree2device
(
child
,
device
)
for
child
in
obj
)
device
=
next
(
model
.
parameters
()).
device
dummy_input
=
_tupletree2device
(
dummy_input
,
device
)
trace
,
_
=
jit
.
get_trace_graph
(
model
,
dummy_input
)
# Let ONNX do the heavy lifting: fusing the convolution nodes; fusing the nodes
# Let ONNX do the heavy lifting: fusing the convolution nodes; fusing the nodes
# composing a GEMM operation; etc.
# composing a GEMM operation; etc.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment