interfaced tensor.lua with TH