<commit_before>local SpatialLPPooling, parent = torch.class('nn.SpatialLPPooling', 'nn.Sequential')

function SpatialLPPooling:__init(nInputPlane, pnorm, kW, kH, dW, dH)
   parent.__init(self)

   dW = dW or kW
   dH = dH or kH
   
   self.kW = kW
   self.kH = kH
   self.dW = dW
   self.dH = dH

   self.nInputPlane = nInputPlane
   self.learnKernel = learnKernel

   if pnorm == 2 then
      self:add(nn.Square())
   else
      self:add(nn.Power(pnorm))
   end
   self:add(nn.SpatialConvolutionMap(nn.tables.oneToOne(nInputPlane), kW, kH, dW, dH))
   if pnorm == 2 then
      self:add(nn.Sqrt(0.01))
   else
      self:add(nn.Power(1/pnorm))
   end

   self:get(2).bias:zero()
   self:get(2).weight:fill(1/(kW*kH))
end

-- we have to override some stuff to avoid nonsense happening
function SpatialLPPooling:reset()
end

function SpatialLPPooling:accGradParameters()
end

function SpatialLPPooling:accUpdateGradParameters()
end

function SpatialLPPooling:zeroGradParameters()
end

function SpatialLPPooling:updateParameters()
end<commit_msg>using lower threshold for LP pooling.<commit_after>local SpatialLPPooling, parent = torch.class('nn.SpatialLPPooling', 'nn.Sequential')

function SpatialLPPooling:__init(nInputPlane, pnorm, kW, kH, dW, dH)
   parent.__init(self)

   dW = dW or kW
   dH = dH or kH
   
   self.kW = kW
   self.kH = kH
   self.dW = dW
   self.dH = dH

   self.nInputPlane = nInputPlane
   self.learnKernel = learnKernel

   if pnorm == 2 then
      self:add(nn.Square())
   else
      self:add(nn.Power(pnorm))
   end
   self:add(nn.SpatialConvolutionMap(nn.tables.oneToOne(nInputPlane), kW, kH, dW, dH))
   if pnorm == 2 then
      self:add(nn.Sqrt(1e-7))
   else
      self:add(nn.Power(1/pnorm))
   end

   self:get(2).bias:zero()
   self:get(2).weight:fill(1/(kW*kH))
end

-- we have to override some stuff to avoid nonsense happening
function SpatialLPPooling:reset()
end

function SpatialLPPooling:accGradParameters()
end

function SpatialLPPooling:accUpdateGradParameters()
end

function SpatialLPPooling:zeroGradParameters()
end

function SpatialLPPooling:updateParameters()
end
{'fraction_non_alphanumeric': 0.11327014218009479, 'fraction_numerical': 0.008056872037914692, 'mean_word_length': 3.967058823529412, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7179396', 'n_tokens_mistral': 847, 'n_tokens_neox': 816, 'n_words': 168}