-
-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
This tries to take the norm of a Broadcasted
, and fails:
julia> using Flux, CUDA
julia> CUDA.allowscalar(false)
julia> model = Dense(1=>1) |> gpu;
julia> state = Flux.setup(OptimiserChain(Descent(), ClipNorm(10)), model);
julia> Flux.update!(state, model, gradient(m -> sum(abs2, m.weight), model)[1]);
ERROR: Scalar indexing is disallowed.
...
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] assertscalar(op::String)
@ GPUArraysCore ~/.julia/packages/GPUArraysCore/lojQM/src/GPUArraysCore.jl:87
[3] getindex(::CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, ::Int64, ::Int64)
@ GPUArrays ~/.julia/packages/GPUArrays/fqD8z/src/host/indexing.jl:9
...
[12] norm(itr::Base.Broadcast.Broadcasted{CUDA.CuArrayStyle{2}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}, typeof(*), Tuple{CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, Float32}}, p::Float64)
@ LinearAlgebra ~/julia-9ded051e9f/share/julia/stdlib/v1.10/LinearAlgebra/src/generic.jl:596
[13] apply!(o::Optimisers.ClipNorm{Float64}, state::Nothing, x::CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, dx::Base.Broadcast.Broadcasted{CUDA.CuArrayStyle{2}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}, typeof(*), Tuple{CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, Float32}})
@ Optimisers ~/.julia/packages/Optimisers/kPdJV/src/rules.jl:584
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working