diff options
author | Soumith Chintala <soumith@gmail.com> | 2016-03-03 17:12:53 +0300 |
---|---|---|
committer | Soumith Chintala <soumith@gmail.com> | 2016-03-03 17:12:53 +0300 |
commit | cf016fe034125e67fb2a53efad2f8e85a6a4a3a0 (patch) | |
tree | 9f6a8b9a7c353b3cd9140f09c485dd83fa2f95a4 | |
parent | ccc9627a95972eca32915100ceddddcfe6e87f43 (diff) | |
parent | 82bdd63dcd753ca936852029a210aa6fea1bfa0d (diff) |
Merge pull request #105 from malcolmreynolds/remove_local_istensor
Remove the istensor local in nesting.lua.
-rw-r--r-- | nesting.lua | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/nesting.lua b/nesting.lua index f77f277..8c497f8 100644 --- a/nesting.lua +++ b/nesting.lua @@ -2,11 +2,10 @@ local nesting = {} local utils = require('nngraph.utils') -local istensor = torch.isTensor -- Creates a clone of a tensor or of a table with tensors. function nesting.cloneNested(obj) - if istensor(obj) then + if torch.isTensor(obj) then return obj:clone() end @@ -20,7 +19,7 @@ end -- Fills the obj with the given value. -- The obj can be a tensor or a table with tensors. function nesting.fillNested(obj, value) - if istensor(obj) then + if torch.isTensor(obj) then obj:fill(value) else for key, child in pairs(obj) do @@ -31,7 +30,7 @@ end -- Resizes all tensors in the output. function nesting.resizeNestedAs(output, input) - if istensor(output) then + if torch.isTensor(output) then output:resizeAs(input) else for key, child in pairs(input) do @@ -73,7 +72,7 @@ end -- The input can contain nested tables. -- The output will contain the same nesting of tables. function nesting.addNestedTo(output, input) - if istensor(output) then + if torch.isTensor(output) then output:add(input) else for key, child in pairs(input) do |