Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/nngraph.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Reynolds <malcolm.reynolds@gmail.com>2016-03-03 15:15:30 +0300
committerMalcolm Reynolds <malcolm.reynolds@gmail.com>2016-03-03 15:18:06 +0300
commit82bdd63dcd753ca936852029a210aa6fea1bfa0d (patch)
tree9f6a8b9a7c353b3cd9140f09c485dd83fa2f95a4
parentccc9627a95972eca32915100ceddddcfe6e87f43 (diff)
Remove the istensor local in nesting.lua.
This enables support for other Tensor implementations, which may provide a new version of torch.isTensor but only be required after nngraph.
-rw-r--r--nesting.lua9
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