From 5e5d7f244a00ab12a5e8d5a0171c6f3bc3c4e9cc Mon Sep 17 00:00:00 2001 From: nicholas-leonard Date: Thu, 10 Jul 2014 13:42:01 -0400 Subject: added accUpdate to nn.LookupTable --- test/test.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/test.lua b/test/test.lua index 135624d..1eb571e 100644 --- a/test/test.lua +++ b/test/test.lua @@ -1,5 +1,9 @@ require 'torch' +-- you can easily test specific units like this: +-- luajit -lnn -e "nn.test{'LookupTable'}" +-- luajit -lnn -e "nn.test{'LookupTable', 'Add'}" + local mytester = torch.Tester() local jac local sjac @@ -1821,6 +1825,13 @@ function nntest.LookupTable() local ferr,berr = jac.testIO(module,input,minval,maxval) mytester:asserteq(ferr, 0, torch.typename(module) .. ' - i/o forward err ') mytester:asserteq(berr, 0, torch.typename(module) .. ' - i/o backward err ') + + -- accUpdate + module:accUpdateOnly() + mytester:assert(not module.gradWeight, 'gradWeight is nil') + module:float() + local output = module:forward(input) + module:backwardUpdate(input, output, 0.1) end function nntest.AddConstant() -- cgit v1.2.3