Skip to content

Commit

Permalink
add exclude option to rnn.test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Leonard committed Feb 18, 2017
1 parent 59e35fe commit f911b83
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions test/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6827,10 +6827,26 @@ function rnntest.getHiddenState()
testHiddenState(lstm, true)
end

function rnn.test(tests, benchmark_)
function rnn.test(tests, benchmark_, exclude)
mytester = torch.Tester()
benchmark = benchmark_
mytester:add(rnntest)
math.randomseed(os.time())
if exclude then
local excludes = {}
assert(tests)
tests = torch.type(tests) == 'table' and tests or {tests}
for i,test in ipairs(tests) do
assert(torch.type(test) == 'string')
excludes[test] = true
end
tests = {}
for testname, testfunc in pairs(rnntest.__tests) do
if not excludes[testname] then
table.insert(tests, testname)
else
print("excluding test: "..testname)
end
end
end
mytester:run(tests)
end

0 comments on commit f911b83

Please sign in to comment.