Commit d77687a6 authored by Benjamin Graham's avatar Benjamin Graham Committed by Benjamin Thomas Graham
Browse files

Rename ValidConvolutions to SubmanifoldConvolutions, update for PyTorch 0.4 Tensor/Variable merge

parent 297e04c0
...@@ -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.ValidConvolution(2,3,16,3,false)) :add(sparseconvnet.SubmanifoldConvolution(2,3,16,3,false))
:add(sparseconvnet.SparseResNet( :add(sparseconvnet.SparseResNet(
2,16,{ 2,16,{
{'b', 16, 2, 1}, {'b', 16, 2, 1},
......
...@@ -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.ValidConvolution(2, 24, 32, 3, False) scn.SubmanifoldConvolution(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.size(), output.data.type()) print(output.shape, output.type())
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment