From f911b83238433f925252daf6a319c8222fbd48f6 Mon Sep 17 00:00:00 2001 From: Nicholas Leonard Date: Fri, 17 Feb 2017 22:42:35 -0500 Subject: [PATCH] add exclude option to rnn.test --- test/test.lua | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/test/test.lua b/test/test.lua index 6d119f3..aa803b2 100644 --- a/test/test.lua +++ b/test/test.lua @@ -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