-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
In line 579 of NeuralLua.lua, the nn.copy function is defined as:
function nn.copy(neural)
local new_neural = neural
return new_neural
end
However, this doesn't perform a copy of the table, it just returns a reference to the same table.
Might you have intended a function like this? (see here for source):
-- Perform deep copy
local function deepcopy(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in next, orig, nil do
copy[deepcopy(orig_key)] = deepcopy(orig_value)
end
setmetatable(copy, deepcopy(getmetatable(orig)))
else -- number, string, boolean, etc
copy = orig
end
return copy
end
-- create a deep copy of a neural network object
function nn.copy( neural )
return deepcopy( neural )
end
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels