Skip to content

Commit

Permalink
tabs -> spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
cossio committed Jun 7, 2020
1 parent 15a041e commit 0c1c82c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ gradient(randn(2), randn(2)) do X,Y
end
```

Now load this package and run that again.
You will get an error. Now load this package and run that again.
18 changes: 9 additions & 9 deletions src/adjoints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
nt = (; (p => [getproperty(dx, p) for dx in Δ] for p in propertynames(result))...)
return back(nt)
end
return result, back
return result, back
end

@adjoint function (::Type{T})(t::NamedTuple) where {T<:StructArray}
Expand All @@ -15,21 +15,21 @@ end
nt = (; (p => [dx[p] for dx in Δ] for p in propertynames(result))...)
return back(nt)
end
return result, back
return result, back
end

@adjoint function literal_getproperty(sa::StructArray, ::Val{key}) where {key}
key::Symbol
result = getproperty(sa, key)
function back::AbstractArray)
nt = (; (p => zero(getproperty(sa, p)) for p in propertynames(sa))...)
key::Symbol
result = getproperty(sa, key)
function back::AbstractArray)
nt = (; (p => zero(getproperty(sa, p)) for p in propertynames(sa))...)
return (Base.setindex(nt, Δ, key), nothing)
end
return result, back
end
return result, back
end

@adjoint function (::Type{T})(t::Tuple) where {K,T<:NamedTuple{K}}
result = T(t)
back::NamedTuple) = (values(T(Δ)),)
return result, back
return result, back
end

0 comments on commit 0c1c82c

Please sign in to comment.