diff options
author | Kevin Bullaughey <kbullaughey@gmail.com> | 2017-03-08 00:14:22 +0300 |
---|---|---|
committer | Kevin Bullaughey <kbullaughey@gmail.com> | 2017-03-08 00:14:22 +0300 |
commit | b487c8af1b218220e4071461a7300e6852fe6be0 (patch) | |
tree | 5c0a011f1ad3f73d8e5fe70a747402fd13618eea /SelectTable.lua | |
parent | 5af10e2807826646d3ebda009b8c3524b42c5758 (diff) |
allow SelectTable to accept input that contains tables of things that are not tensors
Diffstat (limited to 'SelectTable.lua')
-rw-r--r-- | SelectTable.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/SelectTable.lua b/SelectTable.lua index f383a10..ef26f35 100644 --- a/SelectTable.lua +++ b/SelectTable.lua @@ -24,13 +24,15 @@ local function zeroTableCopy(t1, t2) for k, v in pairs(t2) do if (torch.type(v) == "table") then t1[k] = zeroTableCopy(t1[k] or {}, t2[k]) - else + elseif torch.isTensor(v) then if not t1[k] then t1[k] = v:clone():zero() else t1[k]:resizeAs(v) t1[k]:zero() end + else + t1[k] = nil end end for k, v in pairs(t1) do |