Skip to content

Instantly share code, notes, and snippets.

@Keno
Created March 16, 2019 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Keno/b918b17e80d06760679c65b9443806db to your computer and use it in GitHub Desktop.
Save Keno/b918b17e80d06760679c65b9443806db to your computer and use it in GitHub Desktop.
2 1 ─ %1 = Main.randn(Main.Float32, 20)::Array{Float32,1} │
3 │ %2 = Zygote.unwrap(%1)::Array{Float32,1} │╻╷╷╷╷ gradient
│ %3 = Zygote.unwrap(_3)::Float32 ││╻╷ #21
│ %4 = Zygote.unwrap(_2)::Chain{Tuple{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}}}} │││╻╷╷╷╷╷╷ gradient
│ %5 = Zygote.unwrap(%2)::Array{Float32,1} ││││╻╷╷╷╷ #22
│ %6 = Core.tuple(%5, %3)::Tuple{Array{Float32,1},Float32} │││││╻ _forward
│ %7 = Zygote.compute_szs(%6, 1)::Array{Int64,1} ││││││╻╷ adjoint
│ %8 = Core.tuple(%5, %3)::Tuple{Array{Float32,1},Float32} │││││││╻ macro expansion
│ Zygote.compute_szs(%8, 1)::Array{Int64,1} ││││││││┃│╷ _forward
│ %10 = Zygote.vcat(%5, %3)::Array{Float32,1} │││││││││┃│ adjoint
│ %11 = Zygote.__new__(Zygote.∇vcat{Array{Int64,1},Tuple{Array{Float32,1},Float32}}, %7, %6)::Zygote.∇vcat{Array{Int64,1},Tuple{Array{Float32,1},Float32}} Type
│ %12 = Zygote.getfield(%4, :layers)::Tuple{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}}} ││││││╻╷╷╷╷╷╷ getproperty
│ %13 = Zygote.unwrap(%12)::Tuple{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}}} │││││││┃│││││ _forward
│ %14 = Zygote.unwrap(%13)::Tuple{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}}} ││││││││╻╷╷ adjoint
│ %15 = Base.getfield(%14, 1, true)::Dense{typeof(identity),Array{Float32,2},Array{Float32,1}} │││││││╻╷╷╷╷╷╷╷╷╷ first
│ %16 = Zygote.getfield(%15, :W)::Array{Float32,2} ││││││││╻╷╷╷╷╷╷╷ Dense
│ %17 = Zygote.unwrap(%16)::Array{Float32,2} │││││││││┃││││││ getproperty
│ %18 = Zygote.unwrap(%17)::Array{Float32,2} ││││││││││╻╷╷ _forward
│ %19 = Zygote.getfield(%15, :b)::Array{Float32,1} ││││││││││╻╷╷╷╷╷ _forward
│ %20 = Zygote.unwrap(%19)::Array{Float32,1} │││││││││││┃││││ adjoint
│ %21 = Zygote.unwrap(%20)::Array{Float32,1} ││││││││││││╻╷╷ macro expansion
│ %22 = (%18 * %10)::Array{Float32,1} │││││││││╻╷╷╷╷╷ _forward
│ %23 = Zygote.broadcasted(+, %22, %21)::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Array{Float32,1},Array{Float32,1}}}
│ %24 = Zygote.broadcasted(identity, %23)::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(identity),Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Array{Float32,1},Array{Float32,1}}}}}
│ %25 = Zygote.getfield(%24, :args)::Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Array{Float32,1},Array{Float32,1}}}}
│ %26 = Zygote.unwrap(%25)::Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Array{Float32,1},Array{Float32,1}}}}macro expansion
│ %27 = Base.getfield(%26, 1, true)::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Array{Float32,1},Array{Float32,1}}}etindex
│ %28 = Zygote.materialize(%27)::Array{Float32,1} │││││││││││││╻╷╷╷╷ adjoint
│ %29 = Base.getindex(%28)::Float32 ││││││╻╷╷╷╷ adjoint
│ %30 = Zygote.size(%28)::Tuple{Int64} │││││││╻ macro expansion
│ %31 = Zygote.__new__(Zygote.∇getindex{Float32,Tuple{Int64},Tuple{}}, Float32, %30, ())::Zygote.∇getindex{Float32,Tuple{Int64},Tuple{}} Type
│ %32 = Zygote.unwrap(_2)::Chain{Tuple{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}}}} ││││││╻╷╷╷╷ adjoint
│ %33 = Zygote.unwrap(%2)::Array{Float32,1} ││││││╻╷╷╷╷ adjoint
│ %34 = Zygote.unwrap(%32)::Chain{Tuple{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}}}} ││││││╻╷╷╷╷╷╷╷╷╷ #23
│ %35 = Zygote.unwrap(%33)::Array{Float32,1} │││││││╻╷╷╷╷╷╷╷ _forward
│ %36 = Core.tuple(%35, %3)::Tuple{Array{Float32,1},Float32} ││││││││╻╷ _forward
│ %37 = Zygote.compute_szs(%36, 1)::Array{Int64,1} │││││││││╻╷╷ macro expansion
│ %38 = Core.tuple(%35, %3)::Tuple{Array{Float32,1},Float32} ││││││││││╻╷ _forward
│ Zygote.compute_szs(%38, 1)::Array{Int64,1} │││││││││││╻╷ adjoint
│ %40 = Core.tuple(%35, %3)::Tuple{Array{Float32,1},Float32} ││││││││││││╻ macro expansion
│ Zygote.compute_szs(%40, 1)::Array{Int64,1} │││││││││││││┃│╷ _forward
│ %42 = Zygote.vcat(%35, %3)::Array{Float32,1} ││││││││││││││┃│ adjoint
│ %43 = Zygote.__new__(Zygote.∇vcat{Array{Int64,1},Tuple{Array{Float32,1},Float32}}, %37, %36)::Zygote.∇vcat{Array{Int64,1},Tuple{Array{Float32,1},Float32}} Type
│ %44 = Zygote.getfield(%34, :layers)::Tuple{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}}} ││││││││╻╷╷╷╷╷╷╷╷╷ getproperty
│ %45 = Zygote.unwrap(%44)::Tuple{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}}} │││││││││┃││││││││ _forward
│ %46 = Zygote.unwrap(%45)::Tuple{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}}} ││││││││││╻╷╷ adjoint
│ %47 = Zygote.unwrap(%46)::Tuple{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}}} │││││││││││╻╷╷╷╷╷ macro expansion
│ %48 = Base.getfield(%47, 1, true)::Dense{typeof(identity),Array{Float32,2},Array{Float32,1}} │││││││││╻╷╷╷╷╷╷╷╷╷╷╷╷╷ first
│ %49 = Zygote.getfield(%48, :W)::Array{Float32,2} ││││││││││╻╷╷╷╷╷╷╷╷╷╷ Dense
│ %50 = Zygote.unwrap(%49)::Array{Float32,2} │││││││││││┃│││││││││ getproperty
│ %51 = Zygote.unwrap(%50)::Array{Float32,2} ││││││││││││╻╷╷ _forward
│ %52 = Zygote.unwrap(%51)::Array{Float32,2} │││││││││││││╻╷╷╷╷╷ adjoint
│ %53 = Zygote.getfield(%48, :b)::Array{Float32,1} ││││││││││││╻╷╷╷╷╷╷╷╷ _forward
│ %54 = Zygote.unwrap(%53)::Array{Float32,1} │││││││││││││┃│││││││ adjoint
│ %55 = Zygote.unwrap(%54)::Array{Float32,1} ││││││││││││││╻╷╷ macro expansion
│ %56 = Zygote.unwrap(%55)::Array{Float32,1} │││││││││││││││╻╷╷╷╷╷ _forward
│ %57 = (%52 * %42)::Array{Float32,1} │││││││││││╻╷╷╷╷╷╷╷╷ _forward
│ %58 = Zygote.broadcasted(+, %57, %56)::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Array{Float32,1},Array{Float32,1}}}nt
│ %59 = Zygote.broadcasted(identity, %58)::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(identity),Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Array{Float32,1},Array{Float32,1}}}}}
│ %60 = Zygote.getfield(%59, :args)::Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Array{Float32,1},Array{Float32,1}}}}
│ %61 = Zygote.unwrap(%60)::Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Array{Float32,1},Array{Float32,1}}}} macro expansion
│ %62 = Zygote.unwrap(%61)::Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Array{Float32,1},Array{Float32,1}}}} getproperty
│ %63 = Base.getfield(%62, 1, true)::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Array{Float32,1},Array{Float32,1}}} _forward
│ %64 = Zygote.materialize(%63)::Array{Float32,1} │││││││││││││││╻╷╷╷╷╷╷╷ adjoint
│ %65 = Zygote.size(%64)::Tuple{Int64} ││││││││╻╷╷╷ adjoint
│ %66 = Zygote.__new__(Zygote.∇getindex{Float32,Tuple{Int64},Tuple{}}, Float32, %65, ())::Zygote.∇getindex{Float32,Tuple{Int64},Tuple{}}╷╷╷ macro expansion
│ %67 = (%66)(1)::Tuple{Array{Float32,1}} │││││││╻╷╷╷╷╷╷ #2057#back
│ %68 = Base.getfield(%67, 1, true)::Array{Float32,1} ││││││││╻╷╷╷╷╷╷╷ gradtuple1
│ %69 = Zygote.transpose(%52)::LinearAlgebra.Transpose{Float32,Array{Float32,2}} ││││││││╻╷╷╷╷╷╷╷╷╷╷ applychain
│ %70 = (%69 * %68)::Array{Float32,1} │││││││││╻╷╷╷╷ Dense
│ %71 = Zygote.size(%42)::Tuple{Int64} ││││││││││╻ Dense
│ %72 = Zygote.reshape(%70, %71)::Array{Float32,1} │││││││││││╻╷╷╷╷ #2250#back
│ %73 = (%43)(%72)::Tuple{Array{Float32,1},Float32} ││││││││╻╷╷╷╷╷ _forward
│ %74 = %new(Zygote.∇∇vcat{Zygote.∇vcat{Array{Int64,1},Tuple{Array{Float32,1},Float32}}}, %43)::Zygote.∇∇vcat{Zygote.∇vcat{Array{Int64,1},Tuple{Array{Float32,1},Float32}}}
│ %75 = Zygote.__new__(Zygote.∇∇vcat{Zygote.∇vcat{Array{Int64,1},Tuple{Array{Float32,1},Float32}}}, %43)::Zygote.∇∇vcat{Zygote.∇vcat{Array{Int64,1},Tuple{Array{Float32,1},Float32}}}
│ %76 = Base.getfield(%73, 2, true)::Float32 │││││││││╻╷╷╷╷╷╷╷ _forward
│ (Val)(:zs)::Core.Compiler.Const(Val{:zs}(), true) ││││││││╻╷╷╷╷╷╷ back
│ (Val)(:c)::Core.Compiler.Const(Val{:c}(), true) ││││││││╻╷╷╷╷╷╷ back
│ %79 = Base.:*::Core.Compiler.Const(*, false) │││││╻╷╷╷╷ #1616#back
│ %80 = (%79)(1, %76)::Float32 ││││││┃│││ #615
│ %81 = Base.:*::Core.Compiler.Const(*, false) │││││││╻╷ _forward
│ %82 = (%81)(1, %29)::Float32 ││││││││┃│ adjoint
│ %83 = Zygote._tuple_at(%82, $(QuoteNode(Val{2}())), $(QuoteNode(Val{2}())))::Tuple{Nothing,Float32} ││││││╻╷╷╷╷╷╷╷ #23
│ (%75)(%83)::Array{Float32,1} │││││││╻╷╷╷ #2154#back
│ (Val)(:c)::Core.Compiler.Const(Val{:c}(), true) ││││││╻╷╷╷ back
│ %86 = (%31)(%80)::Tuple{Array{Float32,1}} ││││││╻╷╷ _forward
│ %87 = Base.getfield(%86, 1, true)::Array{Float32,1} │││││││╻╷╷╷ _forward
│ %88 = Zygote.transpose(%18)::LinearAlgebra.Transpose{Float32,Array{Float32,2}} ││││││╻╷╷╷╷╷╷╷ applychain
│ %89 = (%88 * %87)::Array{Float32,1} │││││││╻╷ Dense
│ %90 = Zygote.size(%10)::Tuple{Int64} ││││││││╻ Dense
│ %91 = Zygote.reshape(%89, %90)::Array{Float32,1} │││││││││╻╷ #2250#back
│ (%11)(%91)::Tuple{Array{Float32,1},Float32} ││││││╻╷╷ _forward
│ %93 = %new(Zygote.∇∇vcat{Zygote.∇vcat{Array{Int64,1},Tuple{Array{Float32,1},Float32}}}, %11)::Zygote.∇∇vcat{Zygote.∇vcat{Array{Int64,1},Tuple{Array{Float32,1},Float32}}}
│ (Val)(:zs)::Core.Compiler.Const(Val{:zs}(), true) ││││││╻╷╷╷ back
│ (Val)(:c)::Core.Compiler.Const(Val{:c}(), true) ││││││╻╷╷╷ back
│ %96 = (%93)((nothing, 1))::Array{Float32,1} │││╻╷╷╷╷ gradient
│ %97 = Zygote.size(%89)::Tuple{Int64} ││││╻╷╷╷╷╷╷ #22
│ %98 = Zygote.reshape(%96, %97)::Array{Float32,1} │││││┃│││││││ Chain
│ %99 = Zygote.transpose(%87)::LinearAlgebra.Transpose{Float32,Array{Float32,1}} ││││││╻ applychain
│ %100 = (%98 * %99)::Array{Float32,2} │││││││┃│││││ Dense
│ %101 = Zygote.size(%88)::Tuple{Int64,Int64} ││││││││┃││││ Dense
│ %102 = Zygote.reshape(%100, %101)::Array{Float32,2} │││││││││┃│││ #2250#back
│ %103 = Zygote.transpose(%88)::Array{Float32,2} ││││││││││┃││ #878
│ %104 = (%103 * %98)::Array{Float32,1} │││││││││││┃│ #2250#back
│ %105 = Zygote.size(%87)::Tuple{Int64} ││││││││││││┃ #878
│ %106 = Zygote.reshape(%104, %105)::Array{Float32,1} │││││││││││││
│ %107 = Zygote.transpose(%102)::LinearAlgebra.Transpose{Float32,Array{Float32,2}} ││││││││││││╻ #882
│ %108 = Zygote._tuple_at(%106, $(QuoteNode(Val{1}())), $(QuoteNode(Val{1}())))::Tuple{Array{Float32,1}} ││││││╻╷╷ gradtuple1
│ %109 = Base.getfield(%108, 1, true)::Array{Float32,1} │││││││╻╷ #781
│ %110 = Base.getindex(%109)::Float32 ││││││││
│ %111 = (%110 * 1)::Float32 ││││││╻╷╷ #615
│ %112 = Zygote._tuple_at(%111, $(QuoteNode(Val{2}())), $(QuoteNode(Val{2}())))::Tuple{Nothing,Float32} │││││╻╷╷╷╷╷╷╷╷╷ gradient
│ %113 = (%74)(%112)::Array{Float32,1} ││││││╻╷╷╷ #23
│ %114 = Zygote.size(%70)::Tuple{Int64} │││││││╻╷╷╷╷╷╷╷╷╷ Chain
│ %115 = Zygote.reshape(%113, %114)::Array{Float32,1} ││││││││┃│││││││││ applychain
│ %116 = Zygote.transpose(%68)::LinearAlgebra.Transpose{Float32,Array{Float32,1}} │││││││││╻╷╷╷ Dense
│ %117 = (%115 * %116)::Array{Float32,2} ││││││││││┃│││││││ Dense
│ %118 = Zygote.size(%69)::Tuple{Int64,Int64} │││││││││││┃││││││ #2250#back
│ %119 = Zygote.reshape(%117, %118)::Array{Float32,2} ││││││││││││┃│││││ #878
│ %120 = Zygote.transpose(%119)::LinearAlgebra.Transpose{Float32,Array{Float32,2}} │││││││││││││╻╷╷╷ _forward
│ %121 = ($(QuoteNode(Zygote.∇getfield{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}},:W}())))(%120)::Tuple{NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}},Nothing}
│ %122 = (getfield)(%121, 1)::NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}}│││││╻ applychain
│ %123 = Zygote._tuple_at(%122, $(QuoteNode(Val{1}())), $(QuoteNode(Val{1}())))::Tuple{NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}}}
│ %124 = ($(QuoteNode(Zygote.∇getfield{Chain{Tuple{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}}}},:layers}())))(%123)::Tuple{NamedTuple{(:layers,),Tuple{Tuple{NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}}}}},Nothing}
│ %125 = (getfield)(%124, 1)::NamedTuple{(:layers,),Tuple{Tuple{NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}}}}}
│ %126 = ($(QuoteNode(Zygote.∇getfield{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}},:W}())))(%107)::Tuple{NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}},Nothing}
│ %127 = (getfield)(%126, 1)::NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}}││││╻ Dense
│ %128 = Zygote._tuple_at(%127, $(QuoteNode(Val{1}())), $(QuoteNode(Val{1}())))::Tuple{NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}}}
│ %129 = ($(QuoteNode(Zygote.∇getfield{Chain{Tuple{Dense{typeof(identity),Array{Float32,2},Array{Float32,1}}}},:layers}())))(%128)::Tuple{NamedTuple{(:layers,),Tuple{Tuple{NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}}}}},Nothing}
│ %130 = (getfield)(%129, 1)::NamedTuple{(:layers,),Tuple{Tuple{NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}}}}}
│ %131 = Base.getfield(%125, :layers)::Tuple{NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}}} macro expansion
│ %132 = Base.getfield(%130, :layers)::Tuple{NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}}} getproperty
│ %133 = Base.broadcasted(Zygote.accum, %131, %132)::Base.Broadcast.Broadcasted{Base.Broadcast.Style{Tuple},Nothing,typeof(Zygote.accum),Tuple{Tuple{NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}}},Tuple{NamedTuple{(:W, :b, :σ),Tuple{LinearAlgebra.Transpose{Float32,Array{Float32,2}},Nothing,Nothing}}}}}
│ %134 = Base.materialize(%133)::Tuple{NamedTuple{(:W, :b, :σ),Tuple{Array{Float32,2},Nothing,Nothing}}} ││││││
│ %135 = %new(NamedTuple{(:layers,),Tuple{Tuple{NamedTuple{(:W, :b, :σ),Tuple{Array{Float32,2},Nothing,Nothing}}}}}, %134)::NamedTuple{(:layers,),Tuple{Tuple{NamedTuple{(:W, :b, :σ),Tuple{Array{Float32,2},Nothing,Nothing}}}}}
└── return %135 │
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment