Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CarloLucibello committed Oct 18, 2024
1 parent 39a4dea commit 24a6c97
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/misc_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,13 @@ end
x
end
Functors.@functor Tleaf

MLDataDevices.isleaf(::Tleaf) = true

Adapt.adapt_structure(dev::CPUDevice, t::Tleaf) = Tleaf(2 .* dev(t.x))

cpu = cpu_device()
t = Tleaf(ones(2))
@test cpu(t).x == 2 .* ones(2)
t = cpu(t)
@test y.x == 2 .* ones(2)
y = cpu([(t,)])
@test y[1][1].x == 2 .* ones(2)
end

0 comments on commit 24a6c97

Please sign in to comment.