Skip to content

Commit

Permalink
Merge pull request #910 from SciML/datagen
Browse files Browse the repository at this point in the history
Real valued datagen from GridTraining when boundary points are trivial
  • Loading branch information
ChrisRackauckas authored Nov 9, 2024
2 parents ccce83e + 21f5b01 commit ff6d507
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/eltype_matching.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ function Adapt.adapt_storage(::EltypeAdaptor{T}, x::AbstractArray) where {T}
return convert(AbstractArray{T}, x)
end

function Adapt.adapt_storage(::EltypeAdaptor{T}, x::AbstractArray{Union{}}) where {T}
return convert(AbstractArray{T}, x)
end

function Adapt.adapt_storage(::EltypeAdaptor{T}, x::AbstractArray{<:Complex}) where {T}
return convert(AbstractArray{Complex{T}}, x)
end
7 changes: 7 additions & 0 deletions test/NNPDE_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

using NeuralPDE, Cubature, Integrals, QuasiMonteCarlo

# DataGen is Real: https://github.com/SciML/NeuralPDE.jl/issues/906
@parameters x
@variables u(..)

NeuralPDE.generate_training_sets(
[x (-1.0, 1.0)], 0.1, [u(x) ~ x], [0.0 ~ 0.0], Float64, [x], [:u])

function callback(p, l)
if p.iter == 1 || p.iter % 250 == 0
println("Current loss is: $l after $(p.iter) iterations")
Expand Down

0 comments on commit ff6d507

Please sign in to comment.