# Implementation of Spectral Normalization for Machine Learning

**URL:** <https://discourse.julialang.org/t/implementation-of-spectral-normalization-for-machine-learning/76074>\
**Category:** General Usage\
**Created:** [February 9, 2022, 12:39pm UTC](https://discourse.julialang.org/t/implementation-of-spectral-normalization-for-machine-learning/76074 "2022-02-09T12:39:09Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![trahflow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/trahflow/32/30585_2.png) [@trahflow](https://discourse.julialang.org/u/trahflow)\
**Post date:** [February 9, 2022, 1:35pm UTC](https://discourse.julialang.org/t/implementation-of-spectral-normalization-for-machine-learning/76074/4 "2022-02-09T13:35:10Z")

</div>

The problem is that there is currently no `rrule` defined for `svdvals`.  
A workaround would be to define:

```julia
function snorm(X)
    return svd(X).S[1]
end

```

Which does a full svd (for which there is an `rrule` defined)

---

_[View the full topic](https://discourse.julialang.org/t/implementation-of-spectral-normalization-for-machine-learning/76074)._
