Extract a part of a nngraph model after loading it

瀏覽次數:32 次
跳到第一則未讀訊息

Marceau C.

未讀,
2016年7月5日 中午12:13:242016/7/5
收件者:torch7
I downloaded a trained model that is using nngraph.
I want to be able to cut the graph in two, to add my personal stuff in the middle.
Instead of
Z = model:forward( {X1, X2} )

I want to do
Y = modelA:forward( {X1, X2} )
Y = process(Y)
Z = modelB:forward( {Y} )

Is this possible, or is the only way to do it is to extracts nodes one by one to rebuild two models ?

And if I want to do it node by node, what is the proper way to do it ? There seem to be redundancy in the model data structure.
Should I do model.fg.nodes[1].data.module to access the content of each node and then rebuild the nngraph ?

As I am not used to Torch (and lua) I don't know what is the proper way to do it.
Also, how can I manually extract each tensor and save it in a format that can be loaded by Numpy ?

Thanks.

Seokju Lee

未讀,
2017年10月17日 凌晨3:04:542017/10/17
收件者:torch7
How did you solve this issue?

2016년 7월 6일 수요일 오전 1시 13분 24초 UTC+9, Marceau C. 님의 말:

Ronak Kosti

未讀,
2017年10月18日 清晨5:13:032017/10/18
收件者:torch7
Hi guys, 

I am also looking for something similar. Did you find the solution?

Marceau C.

未讀,
2017年10月18日 上午8:58:472017/10/18
收件者:torch7 on behalf of Ronak Kosti
Hi,

If I remember well, I didn't find a solution and solved my problem another way.
Sorry.

--
You received this message because you are subscribed to a topic in the Google Groups "torch7" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/torch7/-pMv4MPkuzs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to torch7+unsubscribe@googlegroups.com.
To post to this group, send email to tor...@googlegroups.com.
Visit this group at https://groups.google.com/group/torch7.
For more options, visit https://groups.google.com/d/optout.

回覆所有人
回覆作者
轉寄
0 則新訊息