diff options
author | Jonas Gehring <jgehring@fb.com> | 2017-05-04 15:07:08 +0300 |
---|---|---|
committer | Jonas Gehring <jgehring@fb.com> | 2017-05-04 15:18:17 +0300 |
commit | 8bd513d668fd9811ec1af015279964c3d1ee16ab (patch) | |
tree | cfe4ddd547309264854a16af8fc48bd50519eb75 /test.lua | |
parent | 3eab13f02e71d4800853d125b48c46239b8c7ec2 (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-x | test.lua | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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() |