<commit_before>function torch.CudaTensor.apply(self, func)
   local x = torch.FloatTensor(self:size()):copy(self)
   x:apply(func)
   self:copy(x)
end

local function Tensor__type(self,type)
   local current = torch.typename(self)
   if not type then return current end
   if type ~= current then
      local new = torch.getmetatable(type).new()
      if self:nElement() > 0 then
         new:resize(self:size()):copy(self)
      end
      return new
   else
      return self
   end
end
local function Tensor__typeAs(self,tensor)
   return self:type(tensor:type())
end
local function Tensor__cuda(self,type)
   return self:type('torch.CudaTensor')
end
local function Tensor__double(self,type)
   return self:type('torch.DoubleTensor')
end
local function Tensor__float(self,type)
   return self:type('torch.FloatTensor')
end

local function Tensor__byte(self,type)
   return self:type('torch.ByteTensor')
end

local function Tensor__char(self,type)
   return self:type('torch.CharTensor')
end

local function Tensor__int(self,type)
   return self:type('torch.IntTensor')
end

local function Tensor__short(self,type)
   return self:type('torch.ShortTensor')
end

local function Tensor__Long(self,type)
   return self:type('torch.LongTensor')
end

rawset(torch.getmetatable('torch.DoubleTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.FloatTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.ByteTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.CharTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.IntTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.ShortTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.LongTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.CudaTensor'), 'cuda', Tensor__cuda)

rawset(torch.getmetatable('torch.CudaTensor'), 'type', Tensor__type)
rawset(torch.getmetatable('torch.CudaTensor'), 'typeAs', Tensor__typeAs)
rawset(torch.getmetatable('torch.CudaTensor'), 'double', Tensor__double)
rawset(torch.getmetatable('torch.CudaTensor'), 'float', Tensor__float)
rawset(torch.getmetatable('torch.CudaTensor'), 'byte', Tensor__byte)
rawset(torch.getmetatable('torch.CudaTensor'), 'char', Tensor__char)
rawset(torch.getmetatable('torch.CudaTensor'), 'int', Tensor__int)
rawset(torch.getmetatable('torch.CudaTensor'), 'short', Tensor__short)
rawset(torch.getmetatable('torch.CudaTensor'), 'long', Tensor__long)

do
    local metatable = torch.getmetatable('torch.CudaTensor')
    for _,func in pairs{'expand', 'expandAs', 'view', 'viewAs', 'repeatTensor', 'permute'} do
        rawset(metatable, func, torch[func])
    end
end<commit_msg>fixing small bug caught by linter<commit_after>function torch.CudaTensor.apply(self, func)
   local x = torch.FloatTensor(self:size()):copy(self)
   x:apply(func)
   self:copy(x)
end

local function Tensor__type(self,type)
   local current = torch.typename(self)
   if not type then return current end
   if type ~= current then
      local new = torch.getmetatable(type).new()
      if self:nElement() > 0 then
         new:resize(self:size()):copy(self)
      end
      return new
   else
      return self
   end
end
local function Tensor__typeAs(self,tensor)
   return self:type(tensor:type())
end
local function Tensor__cuda(self,type)
   return self:type('torch.CudaTensor')
end
local function Tensor__double(self,type)
   return self:type('torch.DoubleTensor')
end
local function Tensor__float(self,type)
   return self:type('torch.FloatTensor')
end

local function Tensor__byte(self,type)
   return self:type('torch.ByteTensor')
end

local function Tensor__char(self,type)
   return self:type('torch.CharTensor')
end

local function Tensor__int(self,type)
   return self:type('torch.IntTensor')
end

local function Tensor__short(self,type)
   return self:type('torch.ShortTensor')
end

local function Tensor__long(self,type)
   return self:type('torch.LongTensor')
end

rawset(torch.getmetatable('torch.DoubleTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.FloatTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.ByteTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.CharTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.IntTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.ShortTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.LongTensor'), 'cuda', Tensor__cuda)
rawset(torch.getmetatable('torch.CudaTensor'), 'cuda', Tensor__cuda)

rawset(torch.getmetatable('torch.CudaTensor'), 'type', Tensor__type)
rawset(torch.getmetatable('torch.CudaTensor'), 'typeAs', Tensor__typeAs)
rawset(torch.getmetatable('torch.CudaTensor'), 'double', Tensor__double)
rawset(torch.getmetatable('torch.CudaTensor'), 'float', Tensor__float)
rawset(torch.getmetatable('torch.CudaTensor'), 'byte', Tensor__byte)
rawset(torch.getmetatable('torch.CudaTensor'), 'char', Tensor__char)
rawset(torch.getmetatable('torch.CudaTensor'), 'int', Tensor__int)
rawset(torch.getmetatable('torch.CudaTensor'), 'short', Tensor__short)
rawset(torch.getmetatable('torch.CudaTensor'), 'long', Tensor__long)

do
    local metatable = torch.getmetatable('torch.CudaTensor')
    for _,func in pairs{'expand', 'expandAs', 'view', 'viewAs', 'repeatTensor', 'permute'} do
        rawset(metatable, func, torch[func])
    end
end
{'fraction_non_alphanumeric': 0.13895131086142323, 'fraction_numerical': 0.0003745318352059925, 'mean_word_length': 6.785714285714286, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1290105', 'n_tokens_mistral': 1736, 'n_tokens_neox': 1821, 'n_words': 336}