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
SparseConvNet
Commits
27b3cb0b
"git@developer.sourcefind.cn:OpenDAS/dcnv3.git" did not exist on "bdd98bcb7f7b96bb9e8afae7e3fe4a077e5d437c"
Commit
27b3cb0b
authored
Jul 24, 2017
by
Benjamin Thomas Graham
Browse files
Update hello-world.py
parent
57b58239
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
examples/hello-world.py
examples/hello-world.py
+4
-3
No files found.
examples/hello-world.py
View file @
27b3cb0b
...
...
@@ -5,10 +5,11 @@
# LICENSE file in the root directory of this source tree.
import
torch
import
torch.legacy.nn
as
nn
import
sparseconvnet.legacy
as
scn
# Use the GPU if there is one, otherwise CPU
t
ensorT
ype
=
'torch.cuda.FloatTensor'
if
torch
.
cuda
.
is_available
()
else
'torch.FloatTensor'
d
type
=
'torch.cuda.FloatTensor'
if
torch
.
cuda
.
is_available
()
else
'torch.FloatTensor'
model
=
scn
.
Sequential
().
add
(
scn
.
SparseVggNet
(
2
,
1
,
...
...
@@ -21,7 +22,7 @@ model = scn.Sequential().add(
scn
.
BatchNormReLU
(
32
)
).
add
(
scn
.
SparseToDense
(
2
)
).
type
(
t
ensorT
ype
)
).
type
(
d
type
)
# output will be 10x10
inputSpatialSize
=
model
.
suggestInputSize
(
torch
.
LongTensor
([
10
,
10
]))
...
...
@@ -50,7 +51,7 @@ for y, line in enumerate(msg):
input
.
precomputeMetadata
(
3
)
model
.
evaluate
()
input
.
type
(
t
ensorT
ype
)
input
.
type
(
d
type
)
output
=
model
.
forward
(
input
)
# Output is 1x32x10x10: our minibatch has 1 sample, the network has 32 output
...
...
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