-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #937 from SciML/ap/boltz_up
refactor: use layers from `Boltz`
- Loading branch information
Showing
23 changed files
with
136 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
name = "DiffEqFlux" | ||
uuid = "aae7a2af-3d4f-5e19-a356-7da93b79d9d0" | ||
authors = ["Chris Rackauckas <[email protected]>"] | ||
version = "3.5.2" | ||
version = "3.6.0" | ||
|
||
[deps] | ||
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" | ||
Boltz = "4544d5e4-abc5-4dea-817f-29e4c205d9c8" | ||
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" | ||
ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471" | ||
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0" | ||
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" | ||
DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c" | ||
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
Lux = "b2108857-7c20-44ae-9111-449ecde12c47" | ||
LuxCore = "bb33d45b-7691-41d6-9220-0943567d0623" | ||
|
@@ -20,22 +18,28 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69" | |
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" | ||
SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1" | ||
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46" | ||
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" | ||
|
||
[weakdeps] | ||
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0" | ||
|
||
[extensions] | ||
DiffEqFluxDataInterpolationsExt = "DataInterpolations" | ||
|
||
[compat] | ||
ADTypes = "1.5" | ||
Aqua = "0.8.7" | ||
BenchmarkTools = "1.5.0" | ||
Boltz = "0.4.2" | ||
ChainRulesCore = "1" | ||
ComponentArrays = "0.15.17" | ||
ConcreteStructs = "0.2" | ||
DataInterpolations = "< 5.3" | ||
DataInterpolations = "5, 6" | ||
DelayDiffEq = "5.47.3" | ||
DiffEqCallbacks = "3.6.2" | ||
Distances = "0.10.11" | ||
Distributed = "1.10" | ||
Distributions = "0.25" | ||
DistributionsAD = "0.6" | ||
DistributionsAD = "0.6.55" | ||
ExplicitImports = "1.9" | ||
Flux = "0.14.15" | ||
ForwardDiff = "0.10" | ||
|
@@ -71,12 +75,15 @@ julia = "1.10" | |
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" | ||
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" | ||
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66" | ||
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0" | ||
DelayDiffEq = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb" | ||
DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def" | ||
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" | ||
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" | ||
DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c" | ||
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7" | ||
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" | ||
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" | ||
Hwloc = "0e44f5e4-bd66-52a0-8798-143a42290a1d" | ||
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" | ||
LuxCUDA = "d0bbae9a-e099-4d5b-a835-1c6931763bda" | ||
|
@@ -95,6 +102,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69" | |
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | ||
StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" | ||
|
||
[targets] | ||
test = ["Aqua", "BenchmarkTools", "ComponentArrays", "DelayDiffEq", "DiffEqCallbacks", "Distances", "Distributed", "ExplicitImports", "Flux", "Hwloc", "InteractiveUtils", "LuxCUDA", "MLDatasets", "NNlib", "OneHotArrays", "Optimisers", "Optimization", "OptimizationOptimJL", "OptimizationOptimisers", "OrdinaryDiffEq", "Printf", "Random", "ReTestItems", "Reexport", "Statistics", "StochasticDiffEq", "Test"] | ||
test = ["Aqua", "BenchmarkTools", "ComponentArrays", "DataInterpolations", "DelayDiffEq", "DiffEqCallbacks", "Distances", "Distributed", "DistributionsAD", "ExplicitImports", "ForwardDiff", "Flux", "Hwloc", "InteractiveUtils", "LuxCUDA", "MLDatasets", "NNlib", "OneHotArrays", "Optimisers", "Optimization", "OptimizationOptimJL", "OptimizationOptimisers", "OrdinaryDiffEq", "Printf", "Random", "ReTestItems", "Reexport", "Statistics", "StochasticDiffEq", "Test", "Zygote"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module DiffEqFluxDataInterpolationsExt | ||
|
||
using DataInterpolations: DataInterpolations | ||
using DiffEqFlux: DiffEqFlux | ||
|
||
@views function DiffEqFlux.collocate_data( | ||
data::AbstractMatrix{T}, tpoints::AbstractVector{T}, | ||
tpoints_sample::AbstractVector{T}, interp, args...) where {T} | ||
u = zeros(T, size(data, 1), length(tpoints_sample)) | ||
du = zeros(T, size(data, 1), length(tpoints_sample)) | ||
for d1 in axes(data, 1) | ||
interpolation = interp(data[d1, :], tpoints, args...) | ||
u[d1, :] .= interpolation.(tpoints_sample) | ||
du[d1, :] .= DataInterpolations.derivative.((interpolation,), tpoints_sample) | ||
end | ||
return du, u | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Tensor Layer | ||
Base.@deprecate TensorProductBasisFunction(f, n) Basis.GeneralBasisFunction{:none}(f, n, 1) | ||
|
||
for B in (:Chebyshev, :Sin, :Cos, :Fourier, :Legendre, :Polynomial) | ||
Bold = Symbol(B, :Basis) | ||
@eval Base.@deprecate $(Bold)(n) Basis.$(B)(n) | ||
end | ||
|
||
Base.@deprecate TensorLayer(model, out_dim::Int, init_p::F = randn) where {F <: Function} Boltz.Layers.TensorProductLayer( | ||
model, out_dim; init_weight = init_p) | ||
|
||
# Spline Layer | ||
function SplineLayer(tspan, tstep, spline_basis; init_saved_points::F = nothing) where {F} | ||
Base.depwarn( | ||
"SplineLayer is deprecated and will be removed in the next major release. Refer to \ | ||
Boltz.jl `Layers.SplineLayer` for the newer version.", | ||
:SplineLayer) | ||
|
||
init_saved_points_corrected = if init_saved_points === nothing | ||
nothing | ||
else | ||
let init_saved_points = init_saved_points | ||
(rng, _, grid_min, grid_max, grid_step) -> begin | ||
return init_saved_points(rng, (grid_min, grid_max), grid_step) | ||
end | ||
end | ||
end | ||
|
||
return Layers.SplineLayer((), first(tspan), last(tspan), tstep, spline_basis; | ||
init_saved_points = init_saved_points_corrected) | ||
end | ||
|
||
export SplineLayer | ||
|
||
# Hamiltonian Neural Network | ||
Base.@deprecate HamiltonianNN(model; ad = AutoZygote()) Layers.HamiltonianNN{true}( | ||
model; autodiff = ad) | ||
|
||
function NeuralHamiltonianDE(model, tspan, args...; ad = AutoForwardDiff(), kwargs...) | ||
Base.depwarn( | ||
"NeuralHamiltonianDE is deprecated, use `NeuralODE` with `Layers.HamiltonianNN` instead.", | ||
:NeuralHamiltonianDE) | ||
hnn = model isa Layers.HamiltonianNN ? model : HamiltonianNN(model; ad) | ||
return NeuralODE(hnn, tspan, args, kwargs) | ||
end | ||
|
||
export NeuralHamiltonianDE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
d2d2b47
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
d2d2b47
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/115174
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: