Skip to content

Commit

Permalink
Merge branch 'master' of github.com:KristianHolme/Crux.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
KristianHolme committed Oct 25, 2024
2 parents 9e62784 + 8a13144 commit 66bcfe0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/extras/spectral_normalization.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Power iteration algorithm for computing the spectral norm
function power_iteration!(W, u, n_iterations)
v = nothing
for i=1:n_iterations
Wu = W' * u
v = Wu ./ (norm(Wu) + eps(Float32))
Wv = W * v
u .= Wv ./ (norm(Wv) + eps(Float32))
end
u, v
v = nothing
for i=1:n_iterations
Wu = W' * u
v = Wu ./ (norm(Wu) + eps(Float32))
Wv = W * v
u .= Wv ./ (norm(Wv) + eps(Float32))
end
u, v
end

# Compute the maximum singular value
Expand Down

0 comments on commit 66bcfe0

Please sign in to comment.