Skip to content

Commit 08cd8cd

Browse files
author
Miha Zgubic
committed
fix commas
1 parent 17dc5f7 commit 08cd8cd

File tree

5 files changed

+41
-41
lines changed

5 files changed

+41
-41
lines changed

src/rulesets/Base/arraymath.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ function rrule(
2929
return (
3030
NoTangent(),
3131
InplaceableThunk(
32-
-> mul!(X̄, Ȳ, B', true, true)
32+
-> mul!(X̄, Ȳ, B', true, true),
3333
@thunk(Ȳ * B'),
3434
),
3535
InplaceableThunk(
36-
-> mul!(X̄, A', Ȳ, true, true)
36+
-> mul!(X̄, A', Ȳ, true, true),
3737
@thunk(A' * Ȳ),
3838
)
3939
)
@@ -52,11 +52,11 @@ function rrule(
5252
return (
5353
NoTangent(),
5454
InplaceableThunk(
55-
-> mul!(X̄, Ȳ, vec(B'), true, true)
55+
-> mul!(X̄, Ȳ, vec(B'), true, true),
5656
@thunk(Ȳ * vec(B')),
5757
),
5858
InplaceableThunk(
59-
-> mul!(X̄, A', Ȳ, true, true)
59+
-> mul!(X̄, A', Ȳ, true, true),
6060
@thunk(A' * Ȳ),
6161
)
6262
)
@@ -73,7 +73,7 @@ function rrule(
7373
NoTangent(),
7474
@thunk(dot(Ȳ, B)'),
7575
InplaceableThunk(
76-
-> mul!(X̄, conj(A), Ȳ, true, true)
76+
-> mul!(X̄, conj(A), Ȳ, true, true),
7777
@thunk(A' * Ȳ),
7878
)
7979
)
@@ -89,7 +89,7 @@ function rrule(
8989
return (
9090
NoTangent(),
9191
InplaceableThunk(
92-
-> mul!(X̄, conj(A), Ȳ, true, true)
92+
-> mul!(X̄, conj(A), Ȳ, true, true),
9393
@thunk(A' * Ȳ),
9494
),
9595
@thunk(dot(Ȳ, B)'),
@@ -114,11 +114,11 @@ function rrule(
114114
= unthunk(ȳ)
115115
matmul = (
116116
InplaceableThunk(
117-
dA -> mul!(dA, Ȳ, B', true, true)
117+
dA -> mul!(dA, Ȳ, B', true, true),
118118
@thunk(Ȳ * B'),
119119
),
120120
InplaceableThunk(
121-
dB -> mul!(dB, A', Ȳ, true, true)
121+
dB -> mul!(dB, A', Ȳ, true, true),
122122
@thunk(A' * Ȳ),
123123
)
124124
)
@@ -128,7 +128,7 @@ function rrule(
128128
@thunk(sum(Ȳ))
129129
else
130130
InplaceableThunk(
131-
dz -> sum!(dz, Ȳ; init=false)
131+
dz -> sum!(dz, Ȳ; init=false),
132132
@thunk(sum!(similar(z, eltype(Ȳ)), Ȳ)),
133133
)
134134
end
@@ -147,11 +147,11 @@ function rrule(
147147
function muladd_pullback_2(ȳ)
148148
dy = unthunk(ȳ)
149149
ut_thunk = InplaceableThunk(
150-
dut -> dut .+= v' .* dy
150+
dut -> dut .+= v' .* dy,
151151
@thunk(v' .* dy),
152152
)
153153
v_thunk = InplaceableThunk(
154-
dv -> dv .+= ut' .* dy
154+
dv -> dv .+= ut' .* dy,
155155
@thunk(ut' .* dy),
156156
)
157157
(NoTangent(), ut_thunk, v_thunk, z isa Bool ? NoTangent() : dy)
@@ -178,7 +178,7 @@ function rrule(
178178
@thunk(sum(Ȳ))
179179
else
180180
InplaceableThunk(
181-
dz -> sum!(dz, Ȳ; init=false)
181+
dz -> sum!(dz, Ȳ; init=false),
182182
@thunk(sum!(similar(z, eltype(Ȳ)), Ȳ)),
183183
)
184184
end

src/rulesets/Base/indexing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function rrule(::typeof(getindex), x::Array{<:Number}, inds...)
1717
end
1818

1919
= InplaceableThunk(
20-
getindex_add!
20+
getindex_add!,
2121
@thunk(getindex_add!(zero(x))),
2222
)
2323
īnds = broadcast(_ -> NoTangent(), inds)

src/rulesets/Base/mapreduce.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function rrule(::typeof(sum), x::AbstractArray{T}; dims=:) where {T<:Number}
1111
function sum_pullback(ȳ)
1212
# broadcasting the two works out the size no-matter `dims`
1313
= InplaceableThunk(
14-
x -> x .+=
14+
x -> x .+=,
1515
@thunk(broadcast(lasttuple, x, ȳ)),
1616
)
1717
return (NoTangent(), x̄)
@@ -93,7 +93,7 @@ function rrule(
9393
y = sum(abs2, x; dims=dims)
9494
function sum_abs2_pullback(ȳ)
9595
x_thunk = InplaceableThunk(
96-
dx -> dx .+= 2 .* real.(ȳ) .* x
96+
dx -> dx .+= 2 .* real.(ȳ) .* x,
9797
@thunk(2 .* real.(ȳ) .* x),
9898
)
9999
return (NoTangent(), NoTangent(), x_thunk)

src/rulesets/LinearAlgebra/blas.jl

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -111,29 +111,29 @@ function rrule(::typeof(gemv), tA::Char, α::T, A::AbstractMatrix{T},
111111
= unthunk(Ȳ)
112112
if uppercase(tA) === 'N'
113113
∂A = InplaceableThunk(
114-
-> ger!', ȳ, x, Ā)
114+
-> ger!', ȳ, x, Ā),
115115
@thunk' ** x'),
116116
)
117117
∂x = InplaceableThunk(
118-
-> gemv!('C', α', A, ȳ, one(T), x̄)
118+
-> gemv!('C', α', A, ȳ, one(T), x̄),
119119
@thunk(gemv('C', α', A, ȳ)),
120120
)
121121
elseif uppercase(tA) === 'C'
122122
∂A = InplaceableThunk(
123-
-> ger!(α, x, ȳ, Ā)
123+
-> ger!(α, x, ȳ, Ā),
124124
@thunk* x *'),
125125
)
126126
∂x = InplaceableThunk(
127-
-> gemv!('N', α', A, ȳ, one(T), x̄)
127+
-> gemv!('N', α', A, ȳ, one(T), x̄),
128128
@thunk(gemv('N', α', A, ȳ)),
129129
)
130130
else # uppercase(tA) === 'T'
131131
∂A = InplaceableThunk(
132-
-> conj!(ger!(α, x, ȳ, conj!(Ā)))
132+
-> conj!(ger!(α, x, ȳ, conj!(Ā))),
133133
@thunk(conj* x *')),
134134
)
135135
∂x = InplaceableThunk(
136-
-> gemv!('N', α', conj(A), ȳ, one(T), x̄)
136+
-> gemv!('N', α', conj(A), ȳ, one(T), x̄),
137137
@thunk(gemv('N', α', conj(A), ȳ)),
138138
)
139139
end
@@ -167,87 +167,87 @@ function rrule(
167167
if uppercase(tA) === 'N'
168168
if uppercase(tB) === 'N'
169169
∂A = InplaceableThunk(
170-
-> gemm!('N', 'C', α', C̄, B, β, Ā)
170+
-> gemm!('N', 'C', α', C̄, B, β, Ā),
171171
@thunk(gemm('N', 'C', α', C̄, B)),
172172
)
173173
∂B = InplaceableThunk(
174-
-> gemm!('C', 'N', α', A, C̄, β, B̄)
174+
-> gemm!('C', 'N', α', A, C̄, β, B̄),
175175
@thunk(gemm('C', 'N', α', A, C̄)),
176176
)
177177
elseif uppercase(tB) === 'C'
178178
∂A = InplaceableThunk(
179-
-> gemm!('N', 'N', α', C̄, B, β, Ā)
179+
-> gemm!('N', 'N', α', C̄, B, β, Ā),
180180
@thunk(gemm('N', 'N', α', C̄, B)),
181181
)
182182
∂B = InplaceableThunk(
183-
-> gemm!('C', 'N', α, C̄, A, β, B̄)
183+
-> gemm!('C', 'N', α, C̄, A, β, B̄),
184184
@thunk(gemm('C', 'N', α, C̄, A)),
185185
)
186186
else # uppercase(tB) === 'T'
187187
∂A = InplaceableThunk(
188-
-> gemm!('N', 'N', α', C̄, conj(B), β, Ā)
188+
-> gemm!('N', 'N', α', C̄, conj(B), β, Ā),
189189
@thunk(gemm('N', 'N', α', C̄, conj(B))),
190190
)
191191
∂B = InplaceableThunk(
192-
-> conj!(gemm!('C', 'N', α, C̄, A, β, conj!(B̄)))
192+
-> conj!(gemm!('C', 'N', α, C̄, A, β, conj!(B̄))),
193193
@thunk(conj(gemm('C', 'N', α, C̄, A))),
194194
)
195195
end
196196
elseif uppercase(tA) === 'C'
197197
if uppercase(tB) === 'N'
198198
∂A = InplaceableThunk(
199-
-> gemm!('N', 'C', α, B, C̄, β, Ā)
199+
-> gemm!('N', 'C', α, B, C̄, β, Ā),
200200
@thunk(gemm('N', 'C', α, B, C̄)),
201201
)
202202
∂B = InplaceableThunk(
203-
-> gemm!('N', 'N', α', A, C̄, β, B̄)
203+
-> gemm!('N', 'N', α', A, C̄, β, B̄),
204204
@thunk(gemm('N', 'N', α', A, C̄)),
205205
)
206206
elseif uppercase(tB) === 'C'
207207
∂A = InplaceableThunk(
208-
-> gemm!('C', 'C', α, B, C̄, β, Ā)
208+
-> gemm!('C', 'C', α, B, C̄, β, Ā),
209209
@thunk(gemm('C', 'C', α, B, C̄)),
210210
)
211211
∂B = InplaceableThunk(
212-
-> gemm!('C', 'C', α, C̄, A, β, B̄)
212+
-> gemm!('C', 'C', α, C̄, A, β, B̄),
213213
@thunk(gemm('C', 'C', α, C̄, A)),
214214
)
215215
else # uppercase(tB) === 'T'
216216
∂A = InplaceableThunk(
217-
-> gemm!('T', 'C', α, B, C̄, β, Ā)
217+
-> gemm!('T', 'C', α, B, C̄, β, Ā),
218218
@thunk(gemm('T', 'C', α, B, C̄)),
219219
)
220220
∂B = InplaceableThunk(
221-
-> gemm!('T', 'T', α', C̄, A, β, B̄)
221+
-> gemm!('T', 'T', α', C̄, A, β, B̄),
222222
@thunk(gemm('T', 'T', α', C̄, A)),
223223
)
224224
end
225225
else # uppercase(tA) === 'T'
226226
if uppercase(tB) === 'N'
227227
∂A = InplaceableThunk(
228-
-> conj!(gemm!('N', 'C', α, B, C̄, β, conj!(Ā)))
228+
-> conj!(gemm!('N', 'C', α, B, C̄, β, conj!(Ā))),
229229
@thunk(conj(gemm('N', 'C', α, B, C̄))),
230230
)
231231
∂B = InplaceableThunk(
232-
-> gemm!('N', 'N', α', conj(A), C̄, β, B̄)
232+
-> gemm!('N', 'N', α', conj(A), C̄, β, B̄),
233233
@thunk(gemm('N', 'N', α', conj(A), C̄)),
234234
)
235235
elseif uppercase(tB) === 'C'
236236
∂A = InplaceableThunk(
237-
-> gemm!('T', 'T', α', B, C̄, β, Ā)
237+
-> gemm!('T', 'T', α', B, C̄, β, Ā),
238238
@thunk(gemm('T', 'T', α', B, C̄)),
239239
)
240240
∂B = InplaceableThunk(
241-
-> gemm!('C', 'T', α, C̄, A, β, B̄)
241+
-> gemm!('C', 'T', α, C̄, A, β, B̄),
242242
@thunk(gemm('C', 'T', α, C̄, A)),
243243
)
244244
else # uppercase(tB) === 'T'
245245
∂A = InplaceableThunk(
246-
-> gemm!('C', 'T', α', B, C̄, β, Ā)
246+
-> gemm!('C', 'T', α', B, C̄, β, Ā),
247247
@thunk(gemm('C', 'T', α', B, C̄)),
248248
)
249249
∂B = InplaceableThunk(
250-
-> gemm!('T', 'C', α', C̄, A, β, B̄)
250+
-> gemm!('T', 'C', α', C̄, A, β, B̄),
251251
@thunk(gemm('T', 'C', α', C̄, A)),
252252
)
253253
end

src/rulesets/LinearAlgebra/norm.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ function rrule(::typeof(norm), x::AbstractArray{<:Number}, p::Real)
3737
dx .+= _normInf_back(x, y, Δy)
3838
else
3939
dx .+= _normp_back_x(x, p, y, Δy)
40-
end
41-
, # out-of-place versions
40+
end,
41+
# out-of-place versions
4242
@thunk(if isempty(x) || p == 0
4343
zero.(x) .* (zero(y) * zero(real(Δy)))
4444
elseif p == 2

0 commit comments

Comments
 (0)