Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- net1 = NetGraph[
- {
- "2x" -> ElementwiseLayer[(2*#) &],
- "sum" -> ThreadingLayer[(#1 + #2) &]
- },
- {
- NetPort["a"] -> "2x" -> "sum",
- NetPort["b"] -> "sum"
- }
- ]
- net1[<|"a" -> {1, 2, 3}, "b" -> {10, 20, 30}|>]
- net1[<|"b" -> {10, 20, 30},"a" -> {1, 2, 3}|>]
- net2 = NetGraph[
- {
- "A" -> PartLayer[1],
- "B" -> PartLayer[2],
- "net1" -> net1
- },
- {
- NetPort["Input"] -> "A",
- NetPort["Input"] -> "B",
- {"A","B"} -> "net1"
- }
- ]
- net2[{{1, 2, 3}, {10, 20, 30}}]
- {<|"b" -> "b", "a" -> "a"|>} -> "net1"
- net2 = NetGraph[
- {
- "a" -> PartLayer[1],
- "b" -> PartLayer[2],
- "net1" -> net1
- },
- {
- NetPort["Input"] -> "a",
- NetPort["Input"] -> "b",
- "b" -> NetPort["net1", "b"],
- "a" -> NetPort["net1", "a"]
- }
- ]
Add Comment
Please, Sign In to add comment