Commit 13bdf051 authored by Benjamin Thomas Graham's avatar Benjamin Thomas Graham
Browse files

Use Height x Width notation in hello world examples

parent 71f496e5
...@@ -47,7 +47,7 @@ input:addSample() ...@@ -47,7 +47,7 @@ input:addSample()
for y,line in ipairs(msg) do for y,line in ipairs(msg) do
for x = 1,string.len(line) do for x = 1,string.len(line) do
if string.sub(line,x,x) == 'O' then if string.sub(line,x,x) == 'O' then
local location = torch.LongTensor{x,y} local location = torch.LongTensor{y, x}
local featureVector = torch.FloatTensor{1} local featureVector = torch.FloatTensor{1}
input:setLocation(location,featureVector,0) input:setLocation(location,featureVector,0)
end end
...@@ -61,7 +61,7 @@ local featureVectors = {} ...@@ -61,7 +61,7 @@ local featureVectors = {}
for y,line in ipairs(msg) do for y,line in ipairs(msg) do
for x = 1,string.len(line) do for x = 1,string.len(line) do
if string.sub(line,x,x) == 'O' then if string.sub(line,x,x) == 'O' then
table.insert(locations, {x,y}) table.insert(locations, {y, x})
table.insert(featureVectors, {1}) table.insert(featureVectors, {1})
end end
end end
......
...@@ -41,7 +41,7 @@ input.addSample() ...@@ -41,7 +41,7 @@ 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):
if c == 'X': if c == 'X':
location = torch.LongTensor([x, y]) location = torch.LongTensor([y, x])
featureVector = torch.FloatTensor([1]) featureVector = torch.FloatTensor([1])
input.setLocation(location, featureVector, 0) input.setLocation(location, featureVector, 0)
...@@ -52,7 +52,7 @@ features = [] ...@@ -52,7 +52,7 @@ features = []
for y, line in enumerate(msg): for y, line in enumerate(msg):
for x, c in enumerate(line): for x, c in enumerate(line):
if c == 'X': if c == 'X':
locations.append([x,y]) locations.append([y, x])
features.append([1]) features.append([1])
locations = torch.LongTensor(locations) locations = torch.LongTensor(locations)
features = torch.FloatTensor(features) features = torch.FloatTensor(features)
......
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