You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases, it would be really handy to be able to do this:
julia> a =randn(5, 100);
julia>norm(a, dims=1) # Doesn't work
ERROR: MethodError: no method matching norm(::Matrix{Float64}; dims=2)
julia>sqrt.(sum(abs2, a, dims=1)) # Intended result (in this case, with `p=2`)1×100 Matrix{Float64}:1.265340.7631552.550442.386451.69696…1.712062.614632.816371.820031.69302
As a more advanced example, for a tensor a of shape (m, n, k), norm(a, dims=(2, 3)) would compute norm(a[i, :, :]) for all i and return something of shape (m, 1, 1).
The text was updated successfully, but these errors were encountered:
In some cases, it would be really handy to be able to do this:
As a more advanced example, for a tensor
a
of shape(m, n, k)
,norm(a, dims=(2, 3))
would computenorm(a[i, :, :])
for alli
and return something of shape(m, 1, 1)
.The text was updated successfully, but these errors were encountered: