Skip to content

How to copy a node from a gmodule to another gmodule? #142

Description

@royal-feng

I want to do something like copy a node from a gmodule called net_A to another gmodule called net_B,so I do such operations
netB.modules[i] = netA.modules[counter]
and when the forward in netB, it failed.And the error imformation like that:
torch/install/bin/luajit: ...torch/install/share/lua/5.1/cudnn/SpatialConvolution.lua:32: Only Cuda supported duh!
stack traceback:
[C]: in function 'assert'
...torch/install/share/lua/5.1/cudnn/SpatialConvolution.lua:32: in function 'resetWeightDescriptors'
...torch/install/share/lua/5.1/cudnn/SpatialConvolution.lua:96: in function 'checkInputChanged'
...torch/install/share/lua/5.1/cudnn/SpatialConvolution.lua:120: in function 'createIODescriptors'
...torch/install/share/lua/5.1/cudnn/SpatialConvolution.lua:188: in function 'func'
/home/zsf/torch/install/share/lua/5.1/nngraph/gmodule.lua:345: in function 'neteval'
/home/zsf/torch/install/share/lua/5.1/nngraph/gmodule.lua:380: in function 'forward'
test3.lua:335: in main chunk
[C]: in function 'dofile'
.../zsf/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00406670

So I try to copy the node.weight from netA to netB,like that
netB.modules[i].weight=netA.modules[counter].weight
netB.modules[i].bias=netA.modules[counter].bias
But the result after netB:forward(input) is not so good. Is my copy operation something wrong?
Thank you for answer!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions