Conversation
Codecov Report
@@ Coverage Diff @@
## master #1698 +/- ##
==========================================
- Coverage 68.52% 68.51% -0.01%
==========================================
Files 30 30
Lines 3867 3869 +2
==========================================
+ Hits 2650 2651 +1
- Misses 1217 1218 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #1698 +/- ##
==========================================
+ Coverage 68.52% 68.67% +0.15%
==========================================
Files 30 30
Lines 3867 3943 +76
==========================================
+ Hits 2650 2708 +58
- Misses 1217 1235 +18
Continue to review full report at Codecov.
|
|
If you replace |
…owering. This is a work-around for a weird feature of Julia that doesn't propagate adjoints properly through `.` broadcasts.
|
I don't really know what I'm doing because I haven't played around with the broadcasting stuff, but: julia> f(x) = x' .+ 1
f (generic function with 1 method)
julia> g(x) = Broadcast.materialize(Broadcast.broadcast(+, adjoint(x), 1))
g (generic function with 1 method)
julia> x = [1, 2]
2-element Array{Int64,1}:
1
2
julia> f(x)
1×2 Array{Int64,2}:
2 3
julia> g(x)
1×2 LinearAlgebra.Adjoint{Int64,Array{Int64,1}}:
2 3
julia> @code_lowered f(x)
CodeInfo(
1 1 ─ %1 = Base.Broadcast.materialize │
│ %2 = Base.Broadcast.broadcasted │
│ %3 = (Base.adjoint)(x) │
│ %4 = (%2)(Main.:+, %3, 1) │
│ %5 = (%1)(%4) │
└── return %5 │
)
julia> @code_lowered g(x)
CodeInfo(
1 1 ─ %1 = (Base.getproperty)(Main.Broadcast, :materialize) │
│ %2 = (Base.getproperty)(Main.Broadcast, :broadcast) │
│ %3 = (Main.adjoint)(x) │
│ %4 = (%2)(Main.:+, %3, 1) │
│ %5 = (%1)(%4) │
└── return %5 │
)Related issues: JuliaLang/julia#25671, JuliaArrays/AxisArrays.jl#131 |
|
It seems to be thank to this: |
Not sure if this is the best way to achieve this, but it seems to work.
Closes #1667.