Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/nn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Gehring <jgehring@fb.com>2017-05-04 15:07:08 +0300
committerJonas Gehring <jgehring@fb.com>2017-05-04 15:18:17 +0300
commit8bd513d668fd9811ec1af015279964c3d1ee16ab (patch)
treecfe4ddd547309264854a16af8fc48bd50519eb75 /test.lua
parent3eab13f02e71d4800853d125b48c46239b8c7ec2 (diff)
WeightNorm: don't serialize weight and gradWeight
Both variables can be re-computed from v and g (and gradV/gradG) upon deserialization.
Diffstat (limited to 'test.lua')
-rwxr-xr-xtest.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/test.lua b/test.lua
index e3a2782..ca06a53 100755
--- a/test.lua
+++ b/test.lua
@@ -167,6 +167,14 @@ function nntest.WeightNorm()
err = nn.Jacobian.testJacobianParameters(model, input,
model.v, model.gradV)
mytester:assert(err < precision, 'Spatial Convolution v')
+
+ -- linear save/load
+ model = nn.WeightNorm(nn.Linear(5, 20))
+ input = torch.rand(10, 5)
+ local out = model:forward(input)
+ local modelr = torch.deserialize(torch.serialize(model))
+ local outr = modelr:forward(input)
+ mytester:assertTensorEq(out, outr)
end
function nntest.CAdd()