New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to access node in a trained gmodule #146
Comments
local ind = 10
local latent = nil
for indexNode, node in pairs(net.forwardnodes) do
if indexNode == ind then
if node.data.module then
latent = node.data.module.output:clone() -- use it to get the specific module output
end
end
end Note that the net.forwardnodes has a dump node(spliting inputs into different input nodes). So |
@Naruto-Sasuke thank you for your kind reply. It works. I also find nnquery https://github.com/bshillingford/nnquery also solve the problem quickly |
It seems that the docs have not describe about the way to get the intermediate layer info. And some people -- A simple function for printing nngraph model
function printNet(net)
for i = 1, net:size(1) do
print(string.format("%d: %s", i, net.modules[i]))
end
end It just prints out the topological order of nngraph. So you need to tell which layer you want(It should not be tough), then you can just |
Hi; As suggested by Naruto, net.modules[i] seems to do the trick. require 'nngraph' a= nn.Identity()() model=nn.Sequential() ---- load data and forward pass the data ----- now to see output of maxpool put 3 in get (), 2 to see convolution feature maps ---- now reshape the feature map itorch.image(res) |
hello, soumith, I have some question.If I have a trained gmodules, how can I have access to node in the gModules? @soumith
The text was updated successfully, but these errors were encountered: