Guest User

Untitled

a guest
Feb 17th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. net1 = NetGraph[
  2. {
  3. "2x" -> ElementwiseLayer[(2*#) &],
  4. "sum" -> ThreadingLayer[(#1 + #2) &]
  5. },
  6. {
  7. NetPort["a"] -> "2x" -> "sum",
  8. NetPort["b"] -> "sum"
  9. }
  10. ]
  11.  
  12. net1[<|"a" -> {1, 2, 3}, "b" -> {10, 20, 30}|>]
  13.  
  14. net1[<|"b" -> {10, 20, 30},"a" -> {1, 2, 3}|>]
  15.  
  16. net2 = NetGraph[
  17. {
  18. "A" -> PartLayer[1],
  19. "B" -> PartLayer[2],
  20. "net1" -> net1
  21. },
  22. {
  23. NetPort["Input"] -> "A",
  24. NetPort["Input"] -> "B",
  25. {"A","B"} -> "net1"
  26. }
  27. ]
  28. net2[{{1, 2, 3}, {10, 20, 30}}]
  29.  
  30. {<|"b" -> "b", "a" -> "a"|>} -> "net1"
  31.  
  32. net2 = NetGraph[
  33. {
  34. "a" -> PartLayer[1],
  35. "b" -> PartLayer[2],
  36. "net1" -> net1
  37. },
  38. {
  39. NetPort["Input"] -> "a",
  40. NetPort["Input"] -> "b",
  41. "b" -> NetPort["net1", "b"],
  42. "a" -> NetPort["net1", "a"]
  43. }
  44. ]
Add Comment
Please, Sign In to add comment