Skip to content

Commit

Permalink
extend.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-leonard committed Feb 12, 2015
1 parent 1db2eff commit ef8e70d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions extend.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@


function torchx.extend(types, funcs, alias)
for _,type in ipairs(types) do
local metatable = torch.getmetatable(alias and ('torch.' .. type .. 'Tensor') or type)
for funcname, func in pairs(funcs) do
rawset(metatable, funcname, func)
end
end
end

0 comments on commit ef8e70d

Please sign in to comment.