Representing the network as a graph.
- Dominant language
- No language data
- Stars
- 369
- Forks
- 63
- PR merge metrics
- No merged PRs in 30d
Description
Is there any way besides parsing the json to work with the network as a graph?
``` julia
using MXNet
using LightGraphs
using JSON
net = @mx.chain mx.Variable(:data) =>
mx.Convolution(num_filter = 64, kernel = (3,3), pad = (1, 1), stride=(1,1)) =>
mx.LeakyReLU(act_type = :prelu) =>
mx.Convolution(num_filter = 128, kernel = (3,3), pad = (1, 1), stride=(1,1)) =>
mx.LeakyReLU(act_type = :prelu) =>
mx.Convolution(num_filter = 2, kernel = (3,3), pad = (1, 1), stride=(1,1)) =>
mx.LeakyReLU(act_type = :prelu) =>
mx.SoftmaxOutput(name=:softmax, multi_output=true)
js_net = JSON.parse(mx.to_json(net))
nodes = js_net["nodes"]
graph = DiGraph(length(nodes))
for (idx, node) in enumerate(nodes)
for edge in node["inputs"]
x, _ = edge
add_edge!(graph, x+1, idx)
end
end
```
I am using this right now to determine which parts of the network should be frozen.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.