Skip to content

Commit

Permalink
move dpnn modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Leonard committed May 26, 2017
1 parent 31bd914 commit 6d8858d
Show file tree
Hide file tree
Showing 66 changed files with 155 additions and 4,596 deletions.
4 changes: 4 additions & 0 deletions AbstractRecurrent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ function AbstractRecurrent:getStepModule(step)
end

function AbstractRecurrent:updateOutput(input)
if self.train ~= false then
self:recycle()
end
if self.zeroMask then
-- where zeroMask = 1, the past is forgotten, that is, the output/gradOutput is zeroed
local stepmodule = (self.train==false) and self.modules[1] or self:getStepModule(self.step)
Expand Down Expand Up @@ -189,6 +192,7 @@ end

function AbstractRecurrent:maskZero(v1)
if not self.maskzero then
assert(not torch.isTypeOf(self.modules[1], 'nn.AbstractRecurrent'), "Doesn't support zero-masking on nested AbstractRecurrent instances")
self.maskzero = true
local stepmodule = nn.MaskZero(self.modules[1], v1)
self.sharedClones = {stepmodule}
Expand Down
6 changes: 6 additions & 0 deletions AbstractSequencerCriterion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ function AbstractSequencerCriterion:setZeroMask(zeroMask)
end
end

function AbstractSequencerCriterion:type(type, typecache)
for key, clone in pairs(self.clones) do
clone:type(type, typecache)
end
return parent.type(self, type, typecache)
end
10 changes: 0 additions & 10 deletions BatchNormalization.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
local _ = require 'moses'
local BN, parent = nn.BatchNormalization, nn.Module

local empty = _.clone(parent.dpnn_mediumEmpty)
table.insert(empty, 'buffer')
table.insert(empty, 'buffer2')
table.insert(empty, 'centered')
table.insert(empty, 'std')
table.insert(empty, 'normalized')
table.insert(empty, 'output')
table.insert(empty, 'gradInput')
BN.dpnn_mediumEmpty = empty

-- for sharedClone
local params = _.clone(parent.dpnn_parameters)
table.insert(params, 'running_mean')
Expand Down
91 changes: 0 additions & 91 deletions BinaryLogisticRegression.lua

This file was deleted.

43 changes: 0 additions & 43 deletions CAddTensorTable.lua

This file was deleted.

43 changes: 6 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,15 @@ SET(luasrc
AbstractSequencer.lua
AbstractSequencerCriterion.lua
BiSequencer.lua
deprecated/BiSequencerLM.lua
CopyGrad.lua
Dropout.lua
ExpandAs.lua
deprecated/FastLSTM.lua
deprecated/GRU.lua
LinearNoBias.lua
LookupTableMaskZero.lua
deprecated/LSTM.lua
MaskZero.lua
MaskZeroCriterion.lua
Module.lua
Mufuru.lua
NormStabilizer.lua
Padding.lua
Recurrence.lua
RecurrentAttention.lua
Recursor.lua
Expand All @@ -42,11 +36,8 @@ SET(luasrc
SeqBLSTM.lua
SeqGRU.lua
SeqLSTM.lua
deprecated/SeqLSTMP.lua
deprecated/SeqReverseSequence.lua
Sequencer.lua
SequencerCriterion.lua
ZeroGrad.lua
test/bigtest.lua
test/test.lua
VariableLength.lua
Expand All @@ -60,52 +51,30 @@ SET(luasrc
ArgMax.lua
BatchNormalization.lua
BinaryClassReward.lua
BinaryLogisticRegression.lua
CAddTensorTable.lua
CategoricalEntropy.lua
Clip.lua
Collapse.lua
Constant.lua
Container.lua
Convert.lua
Criterion.lua
Dictionary.lua
FireModule.lua
Inception.lua
Kmeans.lua
LookupTable.lua
ModuleCriterion.lua
NCECriterion.lua
NCEModule.lua
OneHot.lua
PCAColorTransform.lua
ParallelTable.lua
PrintSize.lua
Reinforce.lua
ReinforceBernoulli.lua
ReinforceCategorical.lua
ReinforceGamma.lua
ReinforceNormal.lua
ReverseSequence.lua
Sequential.lua
Serial.lua
SimpleColorTransform.lua
SpatialBatchNormalization.lua
SpatialBinaryConvolution.lua
SpatialBinaryLogisticRegression.lua
SpatialConvolution.lua
SpatialConvolutionMM.lua
SpatialFeatNormalization.lua
SpatialGlimpse.lua
SpatialMaxPooling.lua
SpatialRegionDropout.lua
SpatialUniformCrop.lua
TotalDropout.lua
VRClassReward.lua
WhiteNoise.lua
ZipTable.lua
ZipTableOneToMany.lua
ReverseUnreverse.lua
deprecated/SeqLSTMP.lua
deprecated/SeqReverseSequence.lua
deprecated/BiSequencerLM.lua
deprecated/FastLSTM.lua
deprecated/GRU.lua
deprecated/LSTM.lua
)

ADD_TORCH_PACKAGE(rnn "${src}" "${luasrc}" "An RNN library for Torch")
Expand Down
35 changes: 0 additions & 35 deletions Clip.lua

This file was deleted.

26 changes: 0 additions & 26 deletions Collapse.lua

This file was deleted.

36 changes: 0 additions & 36 deletions Constant.lua

This file was deleted.

Loading

0 comments on commit 6d8858d

Please sign in to comment.