‹ projects

cluster-rnn

a distributed Torch7 RNN cluster over MPI
Log | Files | Refs | README

misc.lua (344B)


      1 
      2 -- misc utilities
      3 
      4 function clone_list(tensor_list, zero_too)
      5     -- utility function. todo: move away to some utils file?
      6     -- takes a list of tensors and returns a list of cloned tensors
      7     local out = {}
      8     for k,v in pairs(tensor_list) do
      9         out[k] = v:clone()
     10         if zero_too then out[k]:zero() end
     11     end
     12     return out
     13 end