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
d77687a6
Commit
d77687a6
authored
Mar 04, 2018
by
Benjamin Graham
Committed by
Benjamin Thomas Graham
Mar 05, 2018
Browse files
Rename ValidConvolutions to SubmanifoldConvolutions, update for PyTorch 0.4 Tensor/Variable merge
parent
297e04c0
Changes
82
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
examples/Chinese_handwriting/ResNet-D-VSC.lua
examples/Chinese_handwriting/ResNet-D-VSC.lua
+1
-1
examples/hello-world.py
examples/hello-world.py
+6
-6
No files found.
examples/Chinese_handwriting/ResNet-D-VSC.lua
View file @
d77687a6
...
@@ -14,7 +14,7 @@ local denseModel = nn.Sequential()
...
@@ -14,7 +14,7 @@ local denseModel = nn.Sequential()
local
model
=
nn
.
Sequential
():
add
(
sparseModel
):
add
(
denseModel
)
local
model
=
nn
.
Sequential
():
add
(
sparseModel
):
add
(
denseModel
)
sparseModel
sparseModel
:
add
(
sparseconvnet
.
Vali
dConvolution
(
2
,
3
,
16
,
3
,
false
))
:
add
(
sparseconvnet
.
Submanifol
dConvolution
(
2
,
3
,
16
,
3
,
false
))
:
add
(
sparseconvnet
.
SparseResNet
(
:
add
(
sparseconvnet
.
SparseResNet
(
2
,
16
,{
2
,
16
,{
{
'b'
,
16
,
2
,
1
},
{
'b'
,
16
,
2
,
1
},
...
...
examples/hello-world.py
View file @
d77687a6
...
@@ -12,15 +12,15 @@ use_gpu = torch.cuda.is_available()
...
@@ -12,15 +12,15 @@ use_gpu = torch.cuda.is_available()
model
=
scn
.
Sequential
().
add
(
model
=
scn
.
Sequential
().
add
(
scn
.
SparseVggNet
(
2
,
1
,
scn
.
SparseVggNet
(
2
,
1
,
[[
'C'
,
8
],
[
'C'
,
8
],
[
'MP'
,
3
,
2
],
[[
'C'
,
8
],
[
'C'
,
8
],
[
'MP'
,
3
,
2
],
[
'C'
,
16
],
[
'C'
,
16
],
[
'MP'
,
3
,
2
],
[
'C'
,
16
],
[
'C'
,
16
],
[
'MP'
,
3
,
2
],
[
'C'
,
24
],
[
'C'
,
24
],
[
'MP'
,
3
,
2
]])
[
'C'
,
24
],
[
'C'
,
24
],
[
'MP'
,
3
,
2
]])
).
add
(
).
add
(
scn
.
Vali
dConvolution
(
2
,
24
,
32
,
3
,
False
)
scn
.
Submanifol
dConvolution
(
2
,
24
,
32
,
3
,
False
)
).
add
(
).
add
(
scn
.
BatchNormReLU
(
32
)
scn
.
BatchNormReLU
(
32
)
).
add
(
).
add
(
scn
.
SparseToDense
(
2
,
32
)
scn
.
SparseToDense
(
2
,
32
)
)
)
if
use_gpu
:
if
use_gpu
:
model
.
cuda
()
model
.
cuda
()
...
@@ -36,7 +36,7 @@ msg = [
...
@@ -36,7 +36,7 @@ msg = [
" X X X X X X X X X X X X X X X X X X "
,
" X X X X X X X X X X X X X X X X X X "
,
" X X XXX XXX XXX XX X X XX X X XXX XXX "
]
" X X XXX XXX XXX XX X X XX X X XXX XXX "
]
#Add a sample using setLocation
#
Add a sample using setLocation
input
.
addSample
()
input
.
addSample
()
for
y
,
line
in
enumerate
(
msg
):
for
y
,
line
in
enumerate
(
msg
):
for
x
,
c
in
enumerate
(
line
):
for
x
,
c
in
enumerate
(
line
):
...
@@ -45,7 +45,7 @@ for y, line in enumerate(msg):
...
@@ -45,7 +45,7 @@ for y, line in enumerate(msg):
featureVector
=
torch
.
FloatTensor
([
1
])
featureVector
=
torch
.
FloatTensor
([
1
])
input
.
setLocation
(
location
,
featureVector
,
0
)
input
.
setLocation
(
location
,
featureVector
,
0
)
#Add a sample using setLocations
#
Add a sample using setLocations
input
.
addSample
()
input
.
addSample
()
locations
=
[]
locations
=
[]
features
=
[]
features
=
[]
...
@@ -73,4 +73,4 @@ output = model.forward(input)
...
@@ -73,4 +73,4 @@ output = model.forward(input)
# Output is 2x32x10x10: our minibatch has 2 samples, the network has 32 output
# Output is 2x32x10x10: our minibatch has 2 samples, the network has 32 output
# feature planes, and 10x10 is the spatial size of the output.
# feature planes, and 10x10 is the spatial size of the output.
print
(
output
.
s
ize
()
,
output
.
data
.
type
())
print
(
output
.
s
hape
,
output
.
type
())
Prev
1
2
3
4
5
Next
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