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
I tried to use BatchNorm and InstanceNorm after Conv1D. It works on cpu but fails on gpu.
(BatchNorm works fine on gpu after Conv2D)
Here is a minimal example reproducing the bug.
using Flux
device = gpu
xin =rand(Float32, 10, 2, 4) |> device
model =Chain(
Conv((3,), 2=>2, pad=1),
BatchNorm(2),
) |> device
loss(x) = Flux.mse(model(x), x)
ps =params(model)
loss, back = Flux.pullback(ps) doloss(xin)
end
Here is the error message
MethodError: no method matching Float32(::ForwardDiff.Dual{Nothing,Float32,1})
Closest candidates are:Float32(::Real, !Matched::RoundingMode) where T<:AbstractFloat at rounding.jl:200Float32(::T) where T<:Number at boot.jl:715Float32(!Matched::Int8) at float.jl:60...
in top-level scope at Conv1DNorm.jl:19
in pullback at Zygote\iFibI\src\compiler\interface.jl:172
in _pullback at Zygote\iFibI\src\compiler\interface2.jl
in #9 at Conv1DNorm.jl:20
in _pullback at Zygote\iFibI\src\compiler\interface2.jl
in loss at Conv1DNorm.jl:13
in _pullback at Zygote\iFibI\src\compiler\interface2.jl
in Chain at Flux\IjMZL\src\layers\basic.jl:38
in _pullback at Zygote\iFibI\src\compiler\interface2.jl
in applychain at Flux\IjMZL\src\layers\basic.jl:36
in _pullback at Zygote\iFibI\src\compiler\interface2.jl
in applychain at Flux\IjMZL\src\layers\basic.jl:36
in _pullback at Zygote\iFibI\src\compiler\interface2.jl
in BatchNorm at Flux\IjMZL\src\layers\normalise.jl:214
in broadcasted at base\broadcast.jl:1232
in _pullback at ZygoteRules\6nssF\src\adjoint.jl:47
in adjoint at Zygote\iFibI\src\lib\lib.jl:175
in _pullback at ZygoteRules\6nssF\src\adjoint.jl:47
in adjoint at Zygote\iFibI\src\lib\broadcast.jl:193
in broadcast_forward at Zygote\iFibI\src\lib\broadcast.jl:181
in materialize at base\broadcast.jl:820
in copy at base\broadcast.jl:854
in getindex at base\broadcast.jl:564
in _broadcast_getindex at base\broadcast.jl:604
in _broadcast_getindex_evalf at base\broadcast.jl:631
in at Zygote\iFibI\src\lib\broadcast.jl:175
in at CUDA\sjcZt\src\broadcast.jl:21
The text was updated successfully, but these errors were encountered:
I tried to use BatchNorm and InstanceNorm after Conv1D. It works on cpu but fails on gpu.
(BatchNorm works fine on gpu after Conv2D)
Here is a minimal example reproducing the bug.
Here is the error message
The text was updated successfully, but these errors were encountered: