Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Add clearState() for UnfoldedTemporalConvolution
Browse files Browse the repository at this point in the history
Summary:
Implement clearState() to clear internal buffers. This is useful for saving
space when serializing models to disk, for example.

Differential Revision: D4255314

fbshipit-source-id: 425bf6b5953b78d3559c2b5feadbd9c8eaa991bd
  • Loading branch information
jgehring authored and Facebook Github Bot committed Dec 6, 2016
1 parent 538ccf1 commit 513798e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fbnn/UnfoldedTemporalConvolution.lua
Expand Up @@ -142,6 +142,12 @@ end
-- we do not need to accumulate parameters when sharing
UTC.sharedAccUpdateGradParameters = UTC.accUpdateGradParameters

function UTC:clearState()
nn.utils.clear(self, '_paddedInput', '_paddedGradInput', '_unfoldedInput',
'_linearGradOutput', '_unfoldedGradInput')
return parent.clearState(self)
end

function UTC:test()
local function tensoreq(a, b, epsilon)
local delta = a:clone():add(-1, b):abs():max()
Expand Down

0 comments on commit 513798e

Please sign in to comment.