<commit_before>function torch.ClTensor.nn.SoftMax_updateOutput(self, input)
   --  cltorch.setTrace(1)
   if input:dim() ~= 2 then
      error('SoftMax expects 2-d tensor currently')
   end
   if self.maxbuffer == nil then
      --    self.buffer = input:clone()
      self.maxbuffer, self.resind = input:max(2)
      self.vec_size = input:size(2)
   end
   self.output:resize(input:size())
   
   if true then
      if true then
         self.maxbuffer:max(self.resind, input, 2)
         
         self.output:copy(input)
         self.output:csub(self.maxbuffer:expand(input:size(1), input:size(2)))
         self.output:exp()
         self.maxbuffer:sum(self.output,2)
         
         self.output:cdiv(self.maxbuffer:expand(input:size(1), input:size(2)))
         self.output:log()
      end
   end
   --  cltorch.setTrace(0)
   return self.output
end

function torch.ClTensor.nn.SoftMax_updateGradInput(self, input, gradOutput)
   local nElement = self.gradInput:nElement()
   self.gradInput:resizeAs(input)
   if self.gradInput:nElement() ~= nElement then
      self.gradInput:zero()
   end
   
   --  cltorch.setTrace(1)
   if true then
      self.maxbuffer:sum(gradOutput, 2)
      self.gradInput:copy(self.output)
      self.gradInput:exp()
      self.gradInput:cmul(self.maxbuffer:expand(input:size(1), input:size(2)))<commit_msg>make clear that SoftMax not implemented yet<commit_after>function torch.ClTensor.nn.SoftMax_updateOutput(self, input)
   error("Not implemented")

   --  cltorch.setTrace(1)
   if input:dim() ~= 2 then
      error('SoftMax expects 2-d tensor currently')
   end
   if self.maxbuffer == nil then
      --    self.buffer = input:clone()
      self.maxbuffer, self.resind = input:max(2)
      self.vec_size = input:size(2)
   end
   self.output:resize(input:size())
   
   if true then
      if true then
         self.maxbuffer:max(self.resind, input, 2)
         
         self.output:copy(input)
         self.output:csub(self.maxbuffer:expand(input:size(1), input:size(2)))
         self.output:exp()
         self.maxbuffer:sum(self.output,2)
         
         self.output:cdiv(self.maxbuffer:expand(input:size(1), input:size(2)))
         self.output:log()
      end
   end
   --  cltorch.setTrace(0)
   return self.output
end

function torch.ClTensor.nn.SoftMax_updateGradInput(self, input, gradOutput)
   error("Not implemented")

   local nElement = self.gradInput:nElement()
   self.gradInput:resizeAs(input)
   if self.gradInput:nElement() ~= nElement then
      self.gradInput:zero()
   end
   
   --  cltorch.setTrace(1)
   if true then
      self.maxbuffer:sum(gradOutput, 2)
      self.gradInput:copy(self.output)
      self.gradInput:exp()
      self.gradInput:cmul(self.maxbuffer:expand(input:size(1), input:size(2)))
{'fraction_non_alphanumeric': 0.12833453496755587, 'fraction_numerical': 0.011535688536409516, 'mean_word_length': 2.9473684210526314, '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': '3889945', 'n_tokens_mistral': 934, 'n_tokens_neox': 933, 'n_words': 157}