Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit 1931951

Browse files
committed
Ambiguous method
1 parent 5630ef2 commit 1931951

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/LuxDeviceUtils.jl

+6-2
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,12 @@ Return a `LuxCPUDevice` object which can be used to transfer data to CPU.
230230
(::LuxCUDADevice)(x) = fmap(x -> adapt(LuxCUDAAdaptor(), x), x; exclude=_isleaf)
231231
(::LuxAMDGPUDevice)(x) = fmap(x -> adapt(LuxAMDGPUAdaptor(), x), x; exclude=_isleaf)
232232

233-
function (::AbstractLuxDevice)(::LuxCore.AbstractExplicitLayer)
234-
throw(ArgumentError("Lux layers are stateless and hence don't participate in device transfers. Apply this function on the parameters and states generated using `Lux.setup`."))
233+
for dev in (LuxCPUDevice, LuxCUDADevice, LuxAMDGPUDevice)
234+
@eval begin
235+
function (::$dev)(::LuxCore.AbstractExplicitLayer)
236+
throw(ArgumentError("Lux layers are stateless and hence don't participate in device transfers. Apply this function on the parameters and states generated using `Lux.setup`."))
237+
end
238+
end
235239
end
236240

237241
# Adapt Interface

0 commit comments

Comments
 (0)