diff --git a/LICENSE.md b/LICENSE.md index f2d616700..fe0aec9e5 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -The DiffEqSensitivity.jl package is licensed under the MIT "Expat" License: +The SciMLSensitivity.jl package is licensed under the MIT "Expat" License: > Copyright (c) 2016-2020: ChrisRackauckas, Julia Computing. > diff --git a/Project.toml b/Project.toml index faaf6093a..4bfb8cd5a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ -name = "DiffEqSensitivity" -uuid = "41bf760c-e81c-5289-8e54-58b1f1f8abe2" +name = "SciMLSensitivity" +uuid = "1ed8b502-d754-442c-8d5d-10ac956f44a1" authors = ["Christopher Rackauckas ", "Yingbo Ma "] -version = "6.80.0" +version = "7.0.0" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/README.md b/README.md index f2eecb470..8a2c3e476 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,24 @@ -# DiffEqSensitivity.jl +# SciMLSensitivity.jl [![Join the chat at https://julialang.zulipchat.com #sciml-bridged](https://img.shields.io/static/v1?label=Zulip&message=chat&color=9558b2&labelColor=389826)](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged) [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](http://sensitivity.sciml.ai/stable/) -[![Global Docs](https://img.shields.io/badge/docs-SciML-blue.svg)](https://docs.sciml.ai/dev/modules/DiffEqSensitivity/) +[![Global Docs](https://img.shields.io/badge/docs-SciML-blue.svg)](https://docs.sciml.ai/dev/modules/SciMLSensitivity/) -[![codecov](https://codecov.io/gh/SciML/DiffEqSensitivity.jl/branch/master/graph/badge.svg?token=FwXaKBNW67)](https://codecov.io/gh/SciML/DiffEqSensitivity.jl) -[![Build Status](https://github.com/SciML/DiffEqSensitivity.jl/workflows/CI/badge.svg)](https://github.com/SciML/DiffEqSensitivity.jl/actions?query=workflow%3ACI) -[![Build status](https://badge.buildkite.com/e0ee4d9d914eb44a43c291d78c53047eeff95e7edb7881b6f7.svg)](https://buildkite.com/julialang/diffeqsensitivity-dot-jl) +[![codecov](https://codecov.io/gh/SciML/SciMLSensitivity.jl/branch/master/graph/badge.svg?token=FwXaKBNW67)](https://codecov.io/gh/SciML/SciMLSensitivity.jl) +[![Build Status](https://github.com/SciML/SciMLSensitivity.jl/workflows/CI/badge.svg)](https://github.com/SciML/SciMLSensitivity.jl/actions?query=workflow%3ACI) +[![Build status](https://badge.buildkite.com/e0ee4d9d914eb44a43c291d78c53047eeff95e7edb7881b6f7.svg)](https://buildkite.com/julialang/SciMLSensitivity-dot-jl) [![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac) [![SciML Code Style](https://img.shields.io/static/v1?label=code%20style&message=SciML&color=9558b2&labelColor=389826)](https://github.com/SciML/SciMLStyle) -[![Package Downloads](https://shields.io/endpoint?url=https://pkgs.genieframework.com/api/v1/badge/DiffEqSensitivity)](https://pkgs.genieframework.com?packages=DiffEqSensitivity) +[![Package Downloads](https://shields.io/endpoint?url=https://pkgs.genieframework.com/api/v1/badge/SciMLSensitivity)](https://pkgs.genieframework.com?packages=SciMLSensitivity) -DiffEqSensitivity.jl is a component package in the [SciML Scientific Machine Learning ecosystem](https://sciml.ai/). +SciMLSensitivity.jl is a component package in the [SciML Scientific Machine Learning ecosystem](https://sciml.ai/). It holds the sensitivity analysis utilities. Users interested in using this functionality should check out [DifferentialEquations.jl](https://github.com/JuliaDiffEq/DifferentialEquations.jl). ## Tutorials and Documentation -For information on using the package, see the [DiffEqSensitivity](https://docs.sciml.ai/dev/modules/DiffEqSensitivity/) section of the +For information on using the package, see the [SciMLSensitivity](https://docs.sciml.ai/dev/modules/SciMLSensitivity/) section of the [SciML docs](docs.sciml.ai). For information on specific previous versions of this package, see the -[see the stable DiffEqSensitivity-only documentation](https://sensitivity.sciml.ai/stable/). +[see the stable SciMLSensitivity-only documentation](https://sensitivity.sciml.ai/stable/). diff --git a/docs/Project.toml b/docs/Project.toml index fa23d042b..cea0831f2 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -7,7 +7,7 @@ DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def" DiffEqFlux = "aae7a2af-3d4f-5e19-a356-7da93b79d9d0" DiffEqNoiseProcess = "77a26b50-5914-5dd7-bc55-306e6241c503" -DiffEqSensitivity = "41bf760c-e81c-5289-8e54-58b1f1f8abe2" +SciMLSensitivity = "41bf760c-e81c-5289-8e54-58b1f1f8abe2" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" diff --git a/docs/make.jl b/docs/make.jl index 47cb1e07e..36713de67 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,4 +1,4 @@ -using Documenter, DiffEqSensitivity +using Documenter, SciMLSensitivity # Make sure that plots don't throw a bunch of warnings / errors! ENV["GKSwstype"] = "100" @@ -7,11 +7,11 @@ using Plots include("pages.jl") makedocs( - sitename = "DiffEqSensitivity.jl", + sitename = "SciMLSensitivity.jl", authors="Chris Rackauckas et al.", clean = true, doctest = false, - modules = [DiffEqSensitivity], + modules = [SciMLSensitivity], strict = [ :doctest, @@ -29,6 +29,6 @@ makedocs( ) deploydocs( - repo = "github.com/SciML/DiffEqSensitivity.jl.git"; + repo = "github.com/SciML/SciMLSensitivity.jl.git"; push_preview = true ) diff --git a/docs/pages.jl b/docs/pages.jl index 09505b807..68ddaf74f 100644 --- a/docs/pages.jl +++ b/docs/pages.jl @@ -1,5 +1,5 @@ pages = [ - "DiffEqSensitivity.jl: Automatic Differentiation and Adjoints for (Differential) Equation Solvers" => "index.md", + "SciMLSensitivity.jl: Automatic Differentiation and Adjoints for (Differential) Equation Solvers" => "index.md", "Tutorials" => Any[ "Differentiating Ordinary Differential Equations (ODE) Tutorials" => Any[ "ad_examples/differentiating_ode.md", diff --git a/docs/src/Benchmark.md b/docs/src/Benchmark.md index 9f253f2b5..537fe45bd 100644 --- a/docs/src/Benchmark.md +++ b/docs/src/Benchmark.md @@ -25,7 +25,7 @@ Quick summary: - Using `ZygoteVJP` is faster than other vjp choices with FastDense due to the overloads ```julia -using DiffEqFlux, OrdinaryDiffEq, Flux, Optim, Plots, DiffEqSensitivity, +using DiffEqFlux, OrdinaryDiffEq, Flux, Optim, Plots, SciMLSensitivity, Zygote, BenchmarkTools, Random u0 = Float32[2.0; 0.0] diff --git a/docs/src/ad_examples/adjoint_continuous_functional.md b/docs/src/ad_examples/adjoint_continuous_functional.md index 6a4db314f..49ca85277 100644 --- a/docs/src/ad_examples/adjoint_continuous_functional.md +++ b/docs/src/ad_examples/adjoint_continuous_functional.md @@ -37,7 +37,7 @@ straightforward since one can simply use the fact that the solution from `ODEForwardSensitivityProblem` is continuous when `dense=true`. For example, ```@example continuousadjoint -using OrdinaryDiffEq, DiffEqSensitivity +using OrdinaryDiffEq, SciMLSensitivity function f(du,u,p,t) du[1] = dx = p[1]*u[1] - p[2]*u[1]*u[2] diff --git a/docs/src/ad_examples/chaotic_ode.md b/docs/src/ad_examples/chaotic_ode.md index 1f6e97643..d2e05c064 100644 --- a/docs/src/ad_examples/chaotic_ode.md +++ b/docs/src/ad_examples/chaotic_ode.md @@ -20,7 +20,7 @@ can be seen, for instance, when solving the [Lorenz system](https://en.wikipedia `1e-14` tolerances with 9th order integrators and a small machine-epsilon perturbation: ```@example chaosode -using OrdinaryDiffEq, DiffEqSensitivity, Zygote +using OrdinaryDiffEq, SciMLSensitivity, Zygote function lorenz!(du, u, p, t) du[1] = 10 * (u[2] - u[1]) diff --git a/docs/src/ad_examples/differentiating_ode.md b/docs/src/ad_examples/differentiating_ode.md index db637acc6..2bf3ba726 100644 --- a/docs/src/ad_examples/differentiating_ode.md +++ b/docs/src/ad_examples/differentiating_ode.md @@ -78,7 +78,7 @@ to an ODE and computes the gradient of a loss function (the sum of the ODE's out timepoint with dt=0.1) via the adjoint method: ```@example diffode -using Zygote, DiffEqSensitivity +using Zygote, SciMLSensitivity function sum_of_solution(u0,p) _prob = remake(prob,u0=u0,p=p) diff --git a/docs/src/ad_examples/direct_sensitivity.md b/docs/src/ad_examples/direct_sensitivity.md index 89aa4758d..8ed822dc6 100644 --- a/docs/src/ad_examples/direct_sensitivity.md +++ b/docs/src/ad_examples/direct_sensitivity.md @@ -13,7 +13,7 @@ instead of an ODE type. For example, we generate an ODE with the sensitivity equations attached for the Lotka-Volterra equations by: ```@example directsense -using OrdinaryDiffEq, DiffEqSensitivity +using OrdinaryDiffEq, SciMLSensitivity function f(du,u,p,t) du[1] = dx = p[1]*u[1] - p[2]*u[1]*u[2] diff --git a/docs/src/dde_fitting/delay_diffeq.md b/docs/src/dde_fitting/delay_diffeq.md index a824eb437..7d1d4c345 100644 --- a/docs/src/dde_fitting/delay_diffeq.md +++ b/docs/src/dde_fitting/delay_diffeq.md @@ -5,7 +5,7 @@ supported. For example, we can build a layer with a delay differential equation like: ```@example dde -using DifferentialEquations, Optimization, DiffEqSensitivity, +using DifferentialEquations, Optimization, SciMLSensitivity, OptimizationPolyalgorithms diff --git a/docs/src/hybrid_jump_fitting/bouncing_ball.md b/docs/src/hybrid_jump_fitting/bouncing_ball.md index fd8674429..854e7d372 100644 --- a/docs/src/hybrid_jump_fitting/bouncing_ball.md +++ b/docs/src/hybrid_jump_fitting/bouncing_ball.md @@ -8,7 +8,7 @@ data. Assume we have data for the ball's height after 15 seconds. Let's first start by implementing the ODE: ```@example bouncing_ball -using Optimization, OptimizationPolyalgorithms, DiffEqSensitivity, DifferentialEquations +using Optimization, OptimizationPolyalgorithms, SciMLSensitivity, DifferentialEquations function f(du,u,p,t) du[1] = u[2] diff --git a/docs/src/index.md b/docs/src/index.md index 8f9346e70..10e9bf9ad 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,6 +1,6 @@ -# DiffEqSensitivity: Automatic Differentiation and Adjoints for (Differential) Equation Solvers +# SciMLSensitivity: Automatic Differentiation and Adjoints for (Differential) Equation Solvers -DiffEqSensitivity.jl is the automatic differentiation and adjoints system for the SciML +SciMLSensitivity.jl is the automatic differentiation and adjoints system for the SciML ecosystem. Also known as local sensitivity analysis, these methods allow for calculation of fast derivatives of SciML problem types which are commonly used to analyze model sensitivities, callibrate models to data, train neural ODEs, perform automated model @@ -9,7 +9,7 @@ a high level interface that pulls together all of the tools with heuristics and helper functions to make solving inverse problems and inferring models as easy as possible without losing efficiency. -Thus, what DiffEqSensitivity.jl provides is: +Thus, what SciMLSensitivity.jl provides is: - Automatic differentiation overloads for improving the performance and flexibility of AD calls over `solve`. @@ -163,8 +163,8 @@ With this package, you can explore various ways to integrate the two methodologi ## Note on Modularity and Composability with Solvers -Note that DiffEqSensitivity.jl purely built on composable and modular infrastructure. -DiffEqSensitivity provides high level helper functions and documentation for the user, but the +Note that SciMLSensitivity.jl purely built on composable and modular infrastructure. +SciMLSensitivity provides high level helper functions and documentation for the user, but the code generation stack is modular and composes in many different ways. For example, one can use and swap out the ODE solver between any common interface compatible library, like: @@ -176,7 +176,7 @@ use and swap out the ODE solver between any common interface compatible library, - [... etc. many other choices!](https://diffeq.sciml.ai/stable/solvers/ode_solve/) In addition, due to the composability of the system, none of the components are directly -tied to the Flux.jl machine learning framework. For example, you can [use DiffEqSensitivity.jl +tied to the Flux.jl machine learning framework. For example, you can [use SciMLSensitivity.jl to generate TensorFlow graphs and train the neural network with TensorFlow.jl](https://youtu.be/n2MwJ1guGVQ?t=284), [use PyTorch arrays via Torch.jl](https://github.com/FluxML/Torch.jl), and more all with single line code changes by utilizing the underlying code generation. The tutorials shown here @@ -192,7 +192,7 @@ Julia packages. ## Citation -If you use DiffEqSensitivity.jl or are influenced by its ideas, please cite: +If you use SciMLSensitivity.jl or are influenced by its ideas, please cite: ``` @article{rackauckas2020universal, diff --git a/docs/src/manual/differential_equation_sensitivities.md b/docs/src/manual/differential_equation_sensitivities.md index 199b0227b..64c08d841 100644 --- a/docs/src/manual/differential_equation_sensitivities.md +++ b/docs/src/manual/differential_equation_sensitivities.md @@ -1,6 +1,6 @@ # [Sensitivity Algorithms for Differential Equations with Automatic Differentiation (AD)](@id sensitivity_diffeq) -DiffEqSensitivity.jl's high level interface allows for specifying a +SciMLSensitivity.jl's high level interface allows for specifying a sensitivity algorithm (`sensealg`) to control the method by which `solve` is differentiated in an automatic differentiation (AD) context by a compatible AD library. The underlying algorithms then @@ -19,7 +19,7 @@ system are: Take for example this simple differential equation solve on Lotka-Volterra: ```julia -using DiffEqSensitivity, OrdinaryDiffEq, Zygote +using SciMLSensitivity, OrdinaryDiffEq, Zygote function fiip(du,u,p,t) du[1] = dx = p[1]*u[1] - p[2]*u[1]*u[2] @@ -39,7 +39,7 @@ and `dp` is the derivative of the loss function with respect to the parameters. Because the gradient is calculated by `Zygote.gradient` and Zygote.jl is one of the compatible AD libraries, this derivative calculation will be captured -by the `sensealg` system, and one of DiffEqSensitivity.jl's adjoint overloads +by the `sensealg` system, and one of SciMLSensitivity.jl's adjoint overloads will be used to compute the derivative. By default, if the `sensealg` keyword argument is not defined, then a smart polyalgorithm is used to automatically determine the most appropriate method for a given equation. diff --git a/docs/src/neural_ode/neural_gde.md b/docs/src/neural_ode/neural_gde.md index 6b4939cfb..9d0437913 100644 --- a/docs/src/neural_ode/neural_gde.md +++ b/docs/src/neural_ode/neural_gde.md @@ -12,7 +12,7 @@ using GraphNeuralNetworks.GNNGraphs: normalized_adjacency using Lux, NNlib, Optimisers, Zygote, Random, ComponentArrays using Lux: AbstractExplicitLayer, glorot_normal, zeros32 import Lux: initialparameters, initialstates -using DiffEqSensitivity +using SciMLSensitivity using Statistics: mean using MLDatasets: Cora using CUDA @@ -152,7 +152,7 @@ using GraphNeuralNetworks.GNNGraphs: normalized_adjacency using Lux, NNlib, Optimisers, Zygote, Random, ComponentArrays using Lux: AbstractExplicitLayer, glorot_normal, zeros32 import Lux: initialparameters, initialstates -using DiffEqSensitivity +using SciMLSensitivity using Statistics: mean using MLDatasets: Cora using CUDA diff --git a/docs/src/neural_ode/neural_ode_flux.md b/docs/src/neural_ode/neural_ode_flux.md index ab93b2df3..79ed2e664 100644 --- a/docs/src/neural_ode/neural_ode_flux.md +++ b/docs/src/neural_ode/neural_ode_flux.md @@ -1,6 +1,6 @@ # Neural Ordinary Differential Equations with Flux -All of the tools of DiffEqSensitivity.jl can be used with Flux.jl. A lot of the examples +All of the tools of SciMLSensitivity.jl can be used with Flux.jl. A lot of the examples have been written to use `FastChain` and `sciml_train`, but in all cases this can be changed to the `Chain` and `Flux.train!` workflow. @@ -10,7 +10,7 @@ This should work almost automatically by using `solve`. Here is an example of optimizing `u0` and `p`. ```@example neuralode1 -using OrdinaryDiffEq, DiffEqSensitivity, Flux, Plots +using OrdinaryDiffEq, SciMLSensitivity, Flux, Plots u0 = Float32[2.; 0.] datasize = 30 @@ -83,7 +83,7 @@ Notice that Optimization.jl works on a vector input, so we have to concatenate ` and `p` and then in the loss function split to the pieces. ```@example neuralode2 -using Flux, OrdinaryDiffEq, DiffEqSensitivity, Optimization, OptimizationOptimisers, OptimizationOptimJL, Plots +using Flux, OrdinaryDiffEq, SciMLSensitivity, Optimization, OptimizationOptimisers, OptimizationOptimJL, Plots u0 = Float32[2.; 0.] datasize = 30 diff --git a/docs/src/ode_fitting/optimization_ode.md b/docs/src/ode_fitting/optimization_ode.md index 961a072ab..9c2fc9b93 100644 --- a/docs/src/ode_fitting/optimization_ode.md +++ b/docs/src/ode_fitting/optimization_ode.md @@ -7,7 +7,7 @@ follow. ```@example optode_cp using DifferentialEquations, Optimization, OptimizationPolyalgorithms, OptimizationOptimJL, - DiffEqSensitivity, Zygote, Plots + SciMLSensitivity, Zygote, Plots function lotka_volterra!(du, u, p, t) x, y = u @@ -73,7 +73,7 @@ more details, [see the DifferentialEquations.jl documentation](http://docs.julia ```@example optode using DifferentialEquations, Optimization, OptimizationPolyalgorithms, OptimizationOptimJL, - DiffEqSensitivity, Zygote, Plots + SciMLSensitivity, Zygote, Plots function lotka_volterra!(du, u, p, t) x, y = u diff --git a/docs/src/ode_fitting/second_order_adjoints.md b/docs/src/ode_fitting/second_order_adjoints.md index de6556663..3c6378841 100644 --- a/docs/src/ode_fitting/second_order_adjoints.md +++ b/docs/src/ode_fitting/second_order_adjoints.md @@ -1,7 +1,7 @@ # Newton and Hessian-Free Newton-Krylov with Second Order Adjoint Sensitivity Analysis In many cases it may be more optimal or more stable to fit using second order -Newton-based optimization techniques. Since DiffEqSensitivity.jl provides +Newton-based optimization techniques. Since SciMLSensitivity.jl provides second order sensitivity analysis for fast Hessians and Hessian-vector products (via forward-over-reverse), we can utilize these in our neural/universal differential equation training processes. diff --git a/docs/src/optimal_control/SDE_control.md b/docs/src/optimal_control/SDE_control.md index f08b08695..9af5ab138 100644 --- a/docs/src/optimal_control/SDE_control.md +++ b/docs/src/optimal_control/SDE_control.md @@ -20,7 +20,7 @@ follow a full explanation of the definition and training process: ```julia # load packages using DiffEqFlux -using DiffEqSensitivity +using SciMLSensitivity using Optimization using StochasticDiffEq, DiffEqCallbacks, DiffEqNoiseProcess using Statistics, LinearAlgebra, Random @@ -304,7 +304,7 @@ visualization_callback(res.u, loss(res.u); doplot=true) ### Load packages ```julia using DiffEqFlux -using DiffEqSensitivity +using SciMLSensitivity using Optimization using StochasticDiffEq, DiffEqCallbacks, DiffEqNoiseProcess using Statistics, LinearAlgebra, Random @@ -626,7 +626,7 @@ of the neural network. `sensealg` allows one to switch between the different [sensitivity modes](https://diffeqflux.sciml.ai/dev/ControllingAdjoints/). `InterpolatingAdjoint` and `BacksolveAdjoint` are the two possible continuous adjoint sensitivity methods. The necessary correction between Ito and Stratonovich integrals -is computed under the hood in the DiffEqSensitivity package. +is computed under the hood in the SciMLSensitivity package. ```julia # optimize the parameters for a few epochs with ADAM on time span diff --git a/docs/src/optimal_control/feedback_control.md b/docs/src/optimal_control/feedback_control.md index 429a7a643..7282848b5 100644 --- a/docs/src/optimal_control/feedback_control.md +++ b/docs/src/optimal_control/feedback_control.md @@ -11,7 +11,7 @@ equation to stay close to 1. ```@example udeneuralcontrol using Flux, Optimization, OptimizationPolyalgorithms, OptimizationOptimJL, - DiffEqSensitivity, Zygote, DifferentialEquations, Plots, Random + SciMLSensitivity, Zygote, DifferentialEquations, Plots, Random rng = Random.default_rng() u0 = 1.1f0 diff --git a/docs/src/optimal_control/optimal_control.md b/docs/src/optimal_control/optimal_control.md index cbe7e6aa5..fcabe894e 100644 --- a/docs/src/optimal_control/optimal_control.md +++ b/docs/src/optimal_control/optimal_control.md @@ -37,7 +37,7 @@ of a local minimum. This looks like: ```@example neuraloptimalcontrol using Flux, DifferentialEquations, Optimization, OptimizationOptimJL, OptimizationFlux, - DiffEqSensitivity, Zygote, Plots, Statistics, Random + SciMLSensitivity, Zygote, Plots, Statistics, Random rng = Random.default_rng() tspan = (0.0f0,8.0f0) diff --git a/docs/src/sde_fitting/optimization_sde.md b/docs/src/sde_fitting/optimization_sde.md index aed0b2bf0..086bb6923 100644 --- a/docs/src/sde_fitting/optimization_sde.md +++ b/docs/src/sde_fitting/optimization_sde.md @@ -1,7 +1,7 @@ # Optimization of Stochastic Differential Equations Here we demonstrate `sensealg = ForwardDiffSensitivity()` (provided by -DiffEqSensitivity.jl) for forward-mode automatic differentiation of a small +SciMLSensitivity.jl) for forward-mode automatic differentiation of a small stochastic differential equation. For large parameter equations, like neural stochastic differential equations, you should use reverse-mode automatic differentiation. However, forward-mode can be more efficient for low numbers @@ -15,7 +15,7 @@ is a stochastic process. Each time we solve this equation we get a different solution, so we need a sensible data source. ```@example sde -using DifferentialEquations, DiffEqSensitivity, Plots +using DifferentialEquations, SciMLSensitivity, Plots function lotka_volterra!(du,u,p,t) x,y = u diff --git a/docs/src/training_tips/divergence.md b/docs/src/training_tips/divergence.md index 159f0dbe7..d588ec660 100644 --- a/docs/src/training_tips/divergence.md +++ b/docs/src/training_tips/divergence.md @@ -28,7 +28,7 @@ end A full example making use of this trick is: ```@example divergence -using DifferentialEquations, DiffEqSensitivity, Optimization, OptimizationFlux, OptimizationOptimJL, Plots +using DifferentialEquations, SciMLSensitivity, Optimization, OptimizationFlux, OptimizationOptimJL, Plots function lotka_volterra!(du,u,p,t) rab, wol = u diff --git a/docs/src/training_tips/local_minima.md b/docs/src/training_tips/local_minima.md index 1b0a92070..15b2b4529 100644 --- a/docs/src/training_tips/local_minima.md +++ b/docs/src/training_tips/local_minima.md @@ -159,7 +159,7 @@ one could use a mix of (4) and (5), or breaking up the trajectory into chunks an ```@example resetic -using Flux, Plots, DifferentialEquations, DiffEqSensitivity +using Flux, Plots, DifferentialEquations, SciMLSensitivity #Starting example with tspan (0, 5) diff --git a/src/DiffEqSensitivity.jl b/src/DiffEqSensitivity.jl index 743be171b..6c35e9a6a 100644 --- a/src/DiffEqSensitivity.jl +++ b/src/DiffEqSensitivity.jl @@ -1,4 +1,4 @@ -module DiffEqSensitivity +module SciMLSensitivity using DiffEqBase, ForwardDiff, Tracker, FiniteDiff, Statistics using DiffEqCallbacks, QuadGK, RecursiveArrayTools, LinearAlgebra diff --git a/src/callback_tracking.jl b/src/callback_tracking.jl index fc341a1fa..319d673dd 100644 --- a/src/callback_tracking.jl +++ b/src/callback_tracking.jl @@ -2,7 +2,7 @@ Appends a tracking process to determine the time of the callback to be used in the reverse pass. The rationale is explain in: -https://github.com/SciML/DiffEqSensitivity.jl/issues/4 +https://github.com/SciML/SciMLSensitivity.jl/issues/4 """ track_callbacks(cb,t,u,p,sensealg) = track_callbacks(CallbackSet(cb),t,u,p,sensealg) track_callbacks(cb::CallbackSet,t,u,p,sensealg) = CallbackSet( @@ -154,7 +154,7 @@ Sets up callbacks for the adjoint pass. This is a version that has an effect at each event of the forward pass and defines the reverse pass values via the vjps as described in https://arxiv.org/pdf/1905.10403.pdf Equation 13. -For more information, see https://github.com/SciML/DiffEqSensitivity.jl/issues/4 +For more information, see https://github.com/SciML/SciMLSensitivity.jl/issues/4 """ setup_reverse_callbacks(cb,sensealg,g,cur_time,terminated) = setup_reverse_callbacks(CallbackSet(cb),sensealg,g,cur_time,terminated) function setup_reverse_callbacks(cb::CallbackSet,sensealg,g,cur_time,terminated) diff --git a/src/lss.jl b/src/lss.jl index fad26ae2a..84843a9e7 100644 --- a/src/lss.jl +++ b/src/lss.jl @@ -439,10 +439,10 @@ function accumulate_cost!(dg, u, p, t, sensealg::ForwardLSS, diffcache, indx) if dg === nothing if dg_val isa Tuple - DiffEqSensitivity.gradient!(dg_val[1], pgpu, u, sensealg, pgpu_config) - DiffEqSensitivity.gradient!(dg_val[2], pgpp, p, sensealg, pgpp_config) + SciMLSensitivity.gradient!(dg_val[1], pgpu, u, sensealg, pgpu_config) + SciMLSensitivity.gradient!(dg_val[2], pgpp, p, sensealg, pgpp_config) else - DiffEqSensitivity.gradient!(dg_val, pgpu, u, sensealg, pgpu_config) + SciMLSensitivity.gradient!(dg_val, pgpu, u, sensealg, pgpu_config) end else if dg_val isa Tuple @@ -571,10 +571,10 @@ function wBcorrect!(S,sol,g,Nt,sense,sensealg,dg) _wBinv = @view wBinv[(i-1)*numindvar+1:i*numindvar] if dg === nothing if dg_val isa Tuple - DiffEqSensitivity.gradient!(dg_val[1], pgpu, u, sensealg, pgpu_config) + SciMLSensitivity.gradient!(dg_val[1], pgpu, u, sensealg, pgpu_config) @. _wBinv = _wBinv*dg_val[1]/Nt else - DiffEqSensitivity.gradient!(dg_val, pgpu, u, sensealg, pgpu_config) + SciMLSensitivity.gradient!(dg_val, pgpu, u, sensealg, pgpu_config) @. _wBinv = _wBinv*dg_val/Nt end else @@ -615,7 +615,7 @@ function shadow_adjoint(prob::AdjointLSSProblem,sensealg::AdjointLSS,LSSregulari if dg_val isa Tuple for (j,u) in enumerate(eachcol(umidres)) if dg === nothing - DiffEqSensitivity.gradient!(dg_val[2], pgpp, uf.p, sensealg, pgpp_config) + SciMLSensitivity.gradient!(dg_val[2], pgpp, uf.p, sensealg, pgpp_config) @. res += dg_val[2] else dg[2](dg_val[2],u,uf.p,nothing,n0+j-1) diff --git a/src/nilsas.jl b/src/nilsas.jl index cb291d9f3..74deb48fc 100644 --- a/src/nilsas.jl +++ b/src/nilsas.jl @@ -229,10 +229,10 @@ function accumulate_cost!(dg, y, p, t, nilss::NILSSSensitivityFunction) if dg===nothing if dg_val isa Tuple - DiffEqSensitivity.gradient!(dg_val[1],pgpu,y,alg,pgpu_config) - DiffEqSensitivity.gradient!(dg_val[2],pgpp,y,alg,pgpp_config) + SciMLSensitivity.gradient!(dg_val[1],pgpu,y,alg,pgpu_config) + SciMLSensitivity.gradient!(dg_val[2],pgpp,y,alg,pgpp_config) else - DiffEqSensitivity.gradient!(dg_val,pgpu,y,alg,pgpu_config) + SciMLSensitivity.gradient!(dg_val,pgpu,y,alg,pgpu_config) end else if dg_val isa Tuple diff --git a/src/nilss.jl b/src/nilss.jl index fcde208fc..0cbe27567 100644 --- a/src/nilss.jl +++ b/src/nilss.jl @@ -498,10 +498,10 @@ function accumulate_cost!(_dgdu, dg, u, p, t, sensealg::NILSS, diffcache::NILSSS if dg===nothing if dg_val isa Tuple - DiffEqSensitivity.gradient!(dg_val[1], pgpu, u, sensealg, pgpu_config) + SciMLSensitivity.gradient!(dg_val[1], pgpu, u, sensealg, pgpu_config) copyto!(_dgdu, dg_val[1]) else - DiffEqSensitivity.gradient!(dg_val, pgpu, u, sensealg, pgpu_config) + SciMLSensitivity.gradient!(dg_val, pgpu, u, sensealg, pgpu_config) copyto!(_dgdu, dg_val) end else diff --git a/src/sensitivity_interface.jl b/src/sensitivity_interface.jl index 0a74bb3e6..b469823d3 100644 --- a/src/sensitivity_interface.jl +++ b/src/sensitivity_interface.jl @@ -388,7 +388,7 @@ matrices. ### Example second order sensitivity analysis calculation ```julia -using DiffEqSensitivity, OrdinaryDiffEq, ForwardDiff +using SciMLSensitivity, OrdinaryDiffEq, ForwardDiff using Test function lotka!(du,u,p,t) @@ -444,7 +444,7 @@ matrix. ### Example second order sensitivity analysis calculation ```julia -using DiffEqSensitivity, OrdinaryDiffEq, ForwardDiff +using SciMLSensitivity, OrdinaryDiffEq, ForwardDiff using Test function lotka!(du,u,p,t) diff --git a/test/HybridNODE.jl b/test/HybridNODE.jl index 7c567d783..a88a227fb 100644 --- a/test/HybridNODE.jl +++ b/test/HybridNODE.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, OrdinaryDiffEq, DiffEqCallbacks, Flux +using SciMLSensitivity, OrdinaryDiffEq, DiffEqCallbacks, Flux using Random, Test using Zygote diff --git a/test/adjoint.jl b/test/adjoint.jl index 501339a8d..5f649f32c 100644 --- a/test/adjoint.jl +++ b/test/adjoint.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, OrdinaryDiffEq, RecursiveArrayTools, DiffEqBase, +using SciMLSensitivity, OrdinaryDiffEq, RecursiveArrayTools, DiffEqBase, ForwardDiff, Calculus, QuadGK, LinearAlgebra, Zygote using Test @@ -89,30 +89,30 @@ _,easy_res7 = adjoint_sensitivities(sol_nodense,Tsit5(),t=t,dg_discrete=dg,absto _,easy_res8 = adjoint_sensitivities(solb,Tsit5(),t=t,dg_discrete=dg,abstol=1e-14, reltol=1e-14, - sensealg=InterpolatingAdjoint(autojacvec=DiffEqSensitivity.TrackerVJP())) + sensealg=InterpolatingAdjoint(autojacvec=SciMLSensitivity.TrackerVJP())) _,easy_res9 = adjoint_sensitivities(solb,Tsit5(),t=t,dg_discrete=dg,abstol=1e-14, reltol=1e-14, - sensealg=InterpolatingAdjoint(autojacvec=DiffEqSensitivity.ZygoteVJP())) + sensealg=InterpolatingAdjoint(autojacvec=SciMLSensitivity.ZygoteVJP())) _,easy_res10 = adjoint_sensitivities(solb,Tsit5(),t=t,dg_discrete=dg,abstol=1e-14, reltol=1e-14, - sensealg=InterpolatingAdjoint(autojacvec=DiffEqSensitivity.ReverseDiffVJP()) + sensealg=InterpolatingAdjoint(autojacvec=SciMLSensitivity.ReverseDiffVJP()) ) _,easy_res11 = adjoint_sensitivities(solb,Tsit5(),t=t,dg_discrete=dg,abstol=1e-14, reltol=1e-14, - sensealg=InterpolatingAdjoint(autojacvec=DiffEqSensitivity.ReverseDiffVJP(true)) + sensealg=InterpolatingAdjoint(autojacvec=SciMLSensitivity.ReverseDiffVJP(true)) ) _,easy_res12 = adjoint_sensitivities(solb,Tsit5(),t=t,dg_discrete=dg,abstol=1e-14, reltol=1e-14, - sensealg=InterpolatingAdjoint(autojacvec=DiffEqSensitivity.EnzymeVJP()) + sensealg=InterpolatingAdjoint(autojacvec=SciMLSensitivity.EnzymeVJP()) ) _,easy_res13 = adjoint_sensitivities(solb,Tsit5(),t=t,dg_discrete=dg,abstol=1e-14, reltol=1e-14, - sensealg=QuadratureAdjoint(autojacvec=DiffEqSensitivity.EnzymeVJP()) + sensealg=QuadratureAdjoint(autojacvec=SciMLSensitivity.EnzymeVJP()) ) -adj_prob = ODEAdjointProblem(sol,QuadratureAdjoint(abstol=1e-14,reltol=1e-14,autojacvec=DiffEqSensitivity.ReverseDiffVJP()),t,dg) +adj_prob = ODEAdjointProblem(sol,QuadratureAdjoint(abstol=1e-14,reltol=1e-14,autojacvec=SciMLSensitivity.ReverseDiffVJP()),t,dg) adj_sol = solve(adj_prob,Tsit5(),abstol=1e-14,reltol=1e-14) -integrand = AdjointSensitivityIntegrand(sol,adj_sol,QuadratureAdjoint(abstol=1e-14,reltol=1e-14,autojacvec=DiffEqSensitivity.ReverseDiffVJP())) +integrand = AdjointSensitivityIntegrand(sol,adj_sol,QuadratureAdjoint(abstol=1e-14,reltol=1e-14,autojacvec=SciMLSensitivity.ReverseDiffVJP())) res,err = quadgk(integrand,0.0,10.0,atol=1e-14,rtol=1e-12) @test isapprox(res, easy_res, rtol = 1e-10) @@ -175,25 +175,25 @@ _,easy_res6 = adjoint_sensitivities(soloop_nodense,Tsit5(),t=t,dg_discrete=dg,ab _,easy_res8 = adjoint_sensitivities(soloop_nodense,Tsit5(),t=t,dg_discrete=dg,abstol=1e-14, reltol=1e-14, - sensealg=InterpolatingAdjoint(autojacvec=DiffEqSensitivity.TrackerVJP())) + sensealg=InterpolatingAdjoint(autojacvec=SciMLSensitivity.TrackerVJP())) _,easy_res9 = adjoint_sensitivities(soloop_nodense,Tsit5(),t=t,dg_discrete=dg,abstol=1e-14, reltol=1e-14, - sensealg=InterpolatingAdjoint(autojacvec=DiffEqSensitivity.ZygoteVJP())) + sensealg=InterpolatingAdjoint(autojacvec=SciMLSensitivity.ZygoteVJP())) _,easy_res10 = adjoint_sensitivities(soloop_nodense,Tsit5(),t=t,dg_discrete=dg,abstol=1e-14, reltol=1e-14, - sensealg=InterpolatingAdjoint(autojacvec=DiffEqSensitivity.ReverseDiffVJP()) + sensealg=InterpolatingAdjoint(autojacvec=SciMLSensitivity.ReverseDiffVJP()) ) _,easy_res11 = adjoint_sensitivities(soloop_nodense,Tsit5(),t=t,dg_discrete=dg,abstol=1e-14, reltol=1e-14, - sensealg=InterpolatingAdjoint(autojacvec=DiffEqSensitivity.ReverseDiffVJP(true)) + sensealg=InterpolatingAdjoint(autojacvec=SciMLSensitivity.ReverseDiffVJP(true)) ) #@test_broken _,easy_res12 = adjoint_sensitivities(soloop_nodense,Tsit5(),t=t,dg_discrete=dg,abstol=1e-14, # reltol=1e-14, -# sensealg=InterpolatingAdjoint(autojacvec=DiffEqSensitivity.EnzymeVJP()) +# sensealg=InterpolatingAdjoint(autojacvec=SciMLSensitivity.EnzymeVJP()) # ) isa Tuple #@test_broken _,easy_res13 = adjoint_sensitivities(soloop_nodense,Tsit5(),t=t,dg_discrete=dg,abstol=1e-14, # reltol=1e-14, -# sensealg=QuadratureAdjoint(autojacvec=DiffEqSensitivity.EnzymeVJP()) +# sensealg=QuadratureAdjoint(autojacvec=SciMLSensitivity.EnzymeVJP()) # ) isa Tuple @test isapprox(res, easy_res, rtol = 1e-10) @@ -389,9 +389,9 @@ function dg(out,u,p,t) out[2]= u[1] + u[2] end -adj_prob = ODEAdjointProblem(sol,QuadratureAdjoint(abstol=1e-14,reltol=1e-14,autojacvec=DiffEqSensitivity.ReverseDiffVJP()),nothing,nothing,dg,g) +adj_prob = ODEAdjointProblem(sol,QuadratureAdjoint(abstol=1e-14,reltol=1e-14,autojacvec=SciMLSensitivity.ReverseDiffVJP()),nothing,nothing,dg,g) adj_sol = solve(adj_prob,Tsit5(),abstol=1e-14,reltol=1e-10) -integrand = AdjointSensitivityIntegrand(sol,adj_sol,QuadratureAdjoint(abstol=1e-14,reltol=1e-14,autojacvec=DiffEqSensitivity.ReverseDiffVJP())) +integrand = AdjointSensitivityIntegrand(sol,adj_sol,QuadratureAdjoint(abstol=1e-14,reltol=1e-14,autojacvec=SciMLSensitivity.ReverseDiffVJP())) res,err = quadgk(integrand,0.0,10.0,atol=1e-14,rtol=1e-10) println("Test the `adjoint_sensitivities` utility function") @@ -507,7 +507,7 @@ sol = solve(prob,Tsit5(),abstol=1e-14,reltol=1e-14) reltol=1e-14) @testset "Checkpointed backsolve" begin - using DiffEqSensitivity, OrdinaryDiffEq + using SciMLSensitivity, OrdinaryDiffEq tf = 10.0 function lorenz(du,u,p,t) σ, ρ, β = p @@ -570,7 +570,7 @@ sol = solve(prob,Tsit5(),abstol=1e-14,reltol=1e-14) @test adj2 ≈ adj4 rtol=1e-4 - # LQR Tests from issue https://github.com/SciML/DiffEqSensitivity.jl/issues/300 + # LQR Tests from issue https://github.com/SciML/SciMLSensitivity.jl/issues/300 x_dim = 2 T = 40.0 @@ -624,7 +624,7 @@ sol = solve(prob,Tsit5(),abstol=1e-14,reltol=1e-14) end using Test -using LinearAlgebra, DiffEqSensitivity, OrdinaryDiffEq, ForwardDiff, QuadGK +using LinearAlgebra, SciMLSensitivity, OrdinaryDiffEq, ForwardDiff, QuadGK @testset "Adjoint of differential algebric equations with mass matrix" begin function G(p, prob, ts, cost) tmp_prob_mm = remake(prob,u0=convert.(eltype(p),prob.u0),p=p) diff --git a/test/adjoint_param.jl b/test/adjoint_param.jl index eb7758690..fd729af7f 100644 --- a/test/adjoint_param.jl +++ b/test/adjoint_param.jl @@ -1,6 +1,6 @@ using Test using OrdinaryDiffEq -using DiffEqSensitivity +using SciMLSensitivity using DiffEqBase using ForwardDiff using QuadGK diff --git a/test/adjoint_shapes.jl b/test/adjoint_shapes.jl index 77c45f04a..96f9d04ae 100644 --- a/test/adjoint_shapes.jl +++ b/test/adjoint_shapes.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, DiffEqSensitivity, Zygote +using OrdinaryDiffEq, SciMLSensitivity, Zygote tspan = (0., 1.) X = randn(3, 4) diff --git a/test/alternative_ad_frontend.jl b/test/alternative_ad_frontend.jl index 7de005272..ea77c5c83 100644 --- a/test/alternative_ad_frontend.jl +++ b/test/alternative_ad_frontend.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, DiffEqSensitivity, ForwardDiff, Zygote, ReverseDiff, Tracker +using OrdinaryDiffEq, SciMLSensitivity, ForwardDiff, Zygote, ReverseDiff, Tracker using Test prob = ODEProblem((u,p,t)->u .* p,[2.0],(0.0,1.0),[3.0]) @@ -15,13 +15,13 @@ dup = Zygote.gradient(senseloss(InterpolatingAdjoint()),u0p)[1] @test_broken ReverseDiff.gradient(senseloss(ReverseDiffAdjoint()),u0p) ≈ dup @test ReverseDiff.gradient(senseloss(TrackerAdjoint()),u0p) ≈ dup @test ReverseDiff.gradient(senseloss(ForwardDiffSensitivity()),u0p) ≈ dup -@test_throws DiffEqSensitivity.ForwardSensitivityOutOfPlaceError ReverseDiff.gradient(senseloss(ForwardSensitivity()),u0p) ≈ dup +@test_throws SciMLSensitivity.ForwardSensitivityOutOfPlaceError ReverseDiff.gradient(senseloss(ForwardSensitivity()),u0p) ≈ dup @test Tracker.gradient(senseloss(InterpolatingAdjoint()),u0p)[1] ≈ dup @test_broken Tracker.gradient(senseloss(ReverseDiffAdjoint()),u0p)[1] ≈ dup @test Tracker.gradient(senseloss(TrackerAdjoint()),u0p)[1] ≈ dup @test Tracker.gradient(senseloss(ForwardDiffSensitivity()),u0p)[1] ≈ dup -@test_throws DiffEqSensitivity.ForwardSensitivityOutOfPlaceError Tracker.gradient(senseloss(ForwardSensitivity()),u0p)[1] ≈ dup +@test_throws SciMLSensitivity.ForwardSensitivityOutOfPlaceError Tracker.gradient(senseloss(ForwardSensitivity()),u0p)[1] ≈ dup @test ForwardDiff.gradient(senseloss(InterpolatingAdjoint()),u0p) ≈ dup @@ -84,12 +84,12 @@ dup = Zygote.gradient(senseloss4(InterpolatingAdjoint()),u0p)[1] @test_broken ReverseDiff.gradient(senseloss4(ReverseDiffAdjoint()),u0p) ≈ dup @test ReverseDiff.gradient(senseloss4(TrackerAdjoint()),u0p) ≈ dup @test ReverseDiff.gradient(senseloss4(ForwardDiffSensitivity()),u0p) ≈ dup -@test_throws DiffEqSensitivity.ForwardSensitivityOutOfPlaceError ReverseDiff.gradient(senseloss4(ForwardSensitivity()),u0p) ≈ dup +@test_throws SciMLSensitivity.ForwardSensitivityOutOfPlaceError ReverseDiff.gradient(senseloss4(ForwardSensitivity()),u0p) ≈ dup @test Tracker.gradient(senseloss4(InterpolatingAdjoint()),u0p)[1] ≈ dup @test_broken Tracker.gradient(senseloss4(ReverseDiffAdjoint()),u0p)[1] ≈ dup @test Tracker.gradient(senseloss4(TrackerAdjoint()),u0p)[1] ≈ dup @test Tracker.gradient(senseloss4(ForwardDiffSensitivity()),u0p)[1] ≈ dup -@test_throws DiffEqSensitivity.ForwardSensitivityOutOfPlaceError Tracker.gradient(senseloss4(ForwardSensitivity()),u0p)[1] ≈ dup +@test_throws SciMLSensitivity.ForwardSensitivityOutOfPlaceError Tracker.gradient(senseloss4(ForwardSensitivity()),u0p)[1] ≈ dup @test ForwardDiff.gradient(senseloss4(InterpolatingAdjoint()),u0p) ≈ dup \ No newline at end of file diff --git a/test/array_partitions.jl b/test/array_partitions.jl index a4ccc223c..715ab59be 100644 --- a/test/array_partitions.jl +++ b/test/array_partitions.jl @@ -1,6 +1,6 @@ import OrdinaryDiffEq import DiffEqBase: DynamicalODEProblem -import DiffEqSensitivity: +import SciMLSensitivity: solve, ODEProblem, ODEAdjointProblem, @@ -37,7 +37,7 @@ solve( dyn_v(v_ap, x_ap, p, t) = ArrayPartition(zeros(), [0.0]) # Originally, I imagined that this may be a bug in Zygote, and it still may be, but I tried doing a pullback on this # function on its own and didn't have any trouble with that. So I'm led to believe that it has something to do with -# how DiffEqSensitivity is invoking Zygote. At least this was as far as I was able to simplify the reproduction. +# how SciMLSensitivity is invoking Zygote. At least this was as far as I was able to simplify the reproduction. dyn_x(v_ap, x_ap, p, t) = begin # ERROR: LoadError: MethodError: no method matching ndims(::Type{NamedTuple{(:x,),Tuple{Tuple{Nothing,Array{Float64,1}}}}}) v = v_ap.x[2] diff --git a/test/autodiff_events.jl b/test/autodiff_events.jl index 0bb57390c..4d52ca7c8 100644 --- a/test/autodiff_events.jl +++ b/test/autodiff_events.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity +using SciMLSensitivity using OrdinaryDiffEq, Calculus, Test using Zygote diff --git a/test/branching_derivatives.jl b/test/branching_derivatives.jl index ea8da7039..c989ec2ed 100644 --- a/test/branching_derivatives.jl +++ b/test/branching_derivatives.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, OrdinaryDiffEq, Zygote, Test +using SciMLSensitivity, OrdinaryDiffEq, Zygote, Test function get_param(breakpoints, values, t) for (i, tᵢ) in enumerate(breakpoints) diff --git a/test/callback_reversediff.jl b/test/callback_reversediff.jl index cc1867a43..a5558483b 100644 --- a/test/callback_reversediff.jl +++ b/test/callback_reversediff.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, Flux, DiffEqSensitivity, DiffEqCallbacks, Test +using OrdinaryDiffEq, Flux, SciMLSensitivity, DiffEqCallbacks, Test using Random Random.seed!(1234) diff --git a/test/callbacks/SDE_callbacks.jl b/test/callbacks/SDE_callbacks.jl index c78948a57..7fa3ec4fe 100644 --- a/test/callbacks/SDE_callbacks.jl +++ b/test/callbacks/SDE_callbacks.jl @@ -1,5 +1,5 @@ using StochasticDiffEq, Zygote -using DiffEqSensitivity, Test, ForwardDiff +using SciMLSensitivity, Test, ForwardDiff abstol = 1e-12 reltol = 1e-12 diff --git a/test/callbacks/continuous_callbacks.jl b/test/callbacks/continuous_callbacks.jl index 32f70d9c8..ac98b2f30 100644 --- a/test/callbacks/continuous_callbacks.jl +++ b/test/callbacks/continuous_callbacks.jl @@ -1,5 +1,5 @@ using OrdinaryDiffEq, Zygote -using DiffEqSensitivity, Test, ForwardDiff +using SciMLSensitivity, Test, ForwardDiff abstol = 1e-12 reltol = 1e-12 @@ -88,7 +88,7 @@ function test_continuous_callback(cb, g, dg!; only_backsolve=false) @test_broken dp2 ≈ dstuff[3:4] end - cb2 = DiffEqSensitivity.track_callbacks(CallbackSet(cb), prob.tspan[1], prob.u0, prob.p, BacksolveAdjoint(autojacvec=ReverseDiffVJP())) + cb2 = SciMLSensitivity.track_callbacks(CallbackSet(cb), prob.tspan[1], prob.u0, prob.p, BacksolveAdjoint(autojacvec=ReverseDiffVJP())) sol_track = solve(prob, Tsit5(), u0=u0, p=p, callback=cb2, abstol=abstol, reltol=reltol, saveat=savingtimes) adj_prob = ODEAdjointProblem(sol_track, BacksolveAdjoint(autojacvec=ReverseDiffVJP()), sol_track.t, dg!, diff --git a/test/callbacks/continuous_vs_discrete.jl b/test/callbacks/continuous_vs_discrete.jl index fd0d0391a..fdab41f13 100644 --- a/test/callbacks/continuous_vs_discrete.jl +++ b/test/callbacks/continuous_vs_discrete.jl @@ -1,5 +1,5 @@ using OrdinaryDiffEq, Zygote -using DiffEqSensitivity, Test, ForwardDiff +using SciMLSensitivity, Test, ForwardDiff abstol = 1e-12 reltol = 1e-12 diff --git a/test/callbacks/discrete_callbacks.jl b/test/callbacks/discrete_callbacks.jl index 26fa96456..4b4ae55a9 100644 --- a/test/callbacks/discrete_callbacks.jl +++ b/test/callbacks/discrete_callbacks.jl @@ -1,5 +1,5 @@ using OrdinaryDiffEq, Zygote -using DiffEqSensitivity, Test, ForwardDiff +using SciMLSensitivity, Test, ForwardDiff abstol = 1e-12 reltol = 1e-12 @@ -100,9 +100,9 @@ function test_discrete_callback(cb, tstops, g, dg!, cboop=nothing, tprev=false) @test dp1 ≈ dp3c @test dp1 ≈ dp4 rtol = 1e-7 - cb2 = DiffEqSensitivity.track_callbacks(CallbackSet(cb), prob.tspan[1], prob.u0, prob.p, BacksolveAdjoint(autojacvec=ReverseDiffVJP())) + cb2 = SciMLSensitivity.track_callbacks(CallbackSet(cb), prob.tspan[1], prob.u0, prob.p, BacksolveAdjoint(autojacvec=ReverseDiffVJP())) sol_track = solve(prob, Tsit5(), u0=u0, p=p, callback=cb2, tstops=tstops, abstol=abstol, reltol=reltol, saveat=savingtimes) - #cb_adj = DiffEqSensitivity.setup_reverse_callbacks(cb2,BacksolveAdjoint()) + #cb_adj = SciMLSensitivity.setup_reverse_callbacks(cb2,BacksolveAdjoint()) adj_prob = ODEAdjointProblem(sol_track, BacksolveAdjoint(autojacvec=ReverseDiffVJP()), sol_track.t, dg!, callback=cb2, diff --git a/test/callbacks/forward_sensitivity_callback.jl b/test/callbacks/forward_sensitivity_callback.jl index 57ad2164e..2ec84fef8 100644 --- a/test/callbacks/forward_sensitivity_callback.jl +++ b/test/callbacks/forward_sensitivity_callback.jl @@ -1,5 +1,5 @@ using OrdinaryDiffEq, DiffEqCallbacks -using DiffEqSensitivity, Zygote, Test +using SciMLSensitivity, Zygote, Test import ForwardDiff import FiniteDiff diff --git a/test/callbacks/vector_continuous_callbacks.jl b/test/callbacks/vector_continuous_callbacks.jl index 3bd2713bf..00fda49ab 100644 --- a/test/callbacks/vector_continuous_callbacks.jl +++ b/test/callbacks/vector_continuous_callbacks.jl @@ -1,5 +1,5 @@ using OrdinaryDiffEq, Zygote -using DiffEqSensitivity, Test, ForwardDiff +using SciMLSensitivity, Test, ForwardDiff abstol = 1e-12 reltol = 1e-12 diff --git a/test/complex_adjoints.jl b/test/complex_adjoints.jl index 500162b65..e23efbdad 100644 --- a/test/complex_adjoints.jl +++ b/test/complex_adjoints.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, OrdinaryDiffEq, Zygote, LinearAlgebra, FiniteDiff, Test +using SciMLSensitivity, OrdinaryDiffEq, Zygote, LinearAlgebra, FiniteDiff, Test A = [1.0*im 2.0; 3.0 4.0] u0 = [1.0 0.0*im; 0.0 1.0] tspan = (0.0, 1.0) diff --git a/test/complex_no_u.jl b/test/complex_no_u.jl index c38de811f..fedb62614 100644 --- a/test/complex_no_u.jl +++ b/test/complex_no_u.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, DiffEqSensitivity, LinearAlgebra, Optimization, OptimizationFlux, Flux +using OrdinaryDiffEq, SciMLSensitivity, LinearAlgebra, Optimization, OptimizationFlux, Flux nn = Chain(Dense(1,16),Dense(16,16,tanh),Dense(16,2)) initial,re = Flux.destructure(nn) diff --git a/test/concrete_solve_derivatives.jl b/test/concrete_solve_derivatives.jl index b2c566ab0..278e28dd3 100644 --- a/test/concrete_solve_derivatives.jl +++ b/test/concrete_solve_derivatives.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, OrdinaryDiffEq, Zygote +using SciMLSensitivity, OrdinaryDiffEq, Zygote using Test, ForwardDiff import Tracker, ReverseDiff, ChainRulesCore diff --git a/test/derivative_shapes.jl b/test/derivative_shapes.jl index 6e9d046a4..0bb0a86fa 100644 --- a/test/derivative_shapes.jl +++ b/test/derivative_shapes.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, DiffEqSensitivity, ForwardDiff, Zygote, Test +using OrdinaryDiffEq, SciMLSensitivity, ForwardDiff, Zygote, Test A = [0. 1.; 1. 0.; 0 0; 0 0]; B = [1. 0.; 0. 1.; 0 0; 0 0]; diff --git a/test/discrete.jl b/test/discrete.jl index 87db58dcf..fa99ee228 100644 --- a/test/discrete.jl +++ b/test/discrete.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, DiffEqSensitivity, Zygote, Test +using OrdinaryDiffEq, SciMLSensitivity, Zygote, Test function loss1(p;sensealg=nothing) f(x,p,t) = [p[1]] diff --git a/test/distributed.jl b/test/distributed.jl index 5fceb3fd9..c46d9dac5 100644 --- a/test/distributed.jl +++ b/test/distributed.jl @@ -2,7 +2,7 @@ using Distributed, Flux addprocs(2) @everywhere begin - using DiffEqSensitivity, OrdinaryDiffEq, Test + using SciMLSensitivity, OrdinaryDiffEq, Test pa = [1.0] u0 = [3.0] diff --git a/test/forward.jl b/test/forward.jl index 4aaca568a..d3d0b531b 100644 --- a/test/forward.jl +++ b/test/forward.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, OrdinaryDiffEq, ForwardDiff, Calculus +using SciMLSensitivity, OrdinaryDiffEq, ForwardDiff, Calculus using Test function fb(du,u,p,t) du[1] = dx = p[1]*u[1] - p[2]*u[1]*u[2] @@ -218,4 +218,4 @@ end u0 = [1.0, 1.0] p = [1.5, 1.0, 3.0, 1.0] -@test_throws DiffEqSensitivity.ForwardSensitivityOutOfPlaceError ODEForwardSensitivityProblem(lotka_volterra_oop, u0, (0.0, 10.0), p) \ No newline at end of file +@test_throws SciMLSensitivity.ForwardSensitivityOutOfPlaceError ODEForwardSensitivityProblem(lotka_volterra_oop, u0, (0.0, 10.0), p) \ No newline at end of file diff --git a/test/forward_chunking.jl b/test/forward_chunking.jl index e7f30ca83..ffff44447 100644 --- a/test/forward_chunking.jl +++ b/test/forward_chunking.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, OrdinaryDiffEq, Zygote, Test, ForwardDiff +using SciMLSensitivity, OrdinaryDiffEq, Zygote, Test, ForwardDiff function fiip(du,u,p,t) du[1] = dx = p[1]*u[1] - p[2]*p[51]*p[75]*u[1]*u[2] diff --git a/test/forward_prob_kwargs.jl b/test/forward_prob_kwargs.jl index 780791bac..f70418557 100644 --- a/test/forward_prob_kwargs.jl +++ b/test/forward_prob_kwargs.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity +using SciMLSensitivity using OrdinaryDiffEq using FiniteDiff diff --git a/test/forward_remake.jl b/test/forward_remake.jl index 63751a778..5ffd1bdba 100644 --- a/test/forward_remake.jl +++ b/test/forward_remake.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, ForwardDiff, Distributions, OrdinaryDiffEq, +using SciMLSensitivity, ForwardDiff, Distributions, OrdinaryDiffEq, LinearAlgebra, Test function fiip(du,u,p,t) diff --git a/test/forwarddiffsensitivity_sparsity_components.jl b/test/forwarddiffsensitivity_sparsity_components.jl index 1614000a8..bfb14db0d 100644 --- a/test/forwarddiffsensitivity_sparsity_components.jl +++ b/test/forwarddiffsensitivity_sparsity_components.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, DiffEqSensitivity, Flux +using OrdinaryDiffEq, SciMLSensitivity, Flux using ComponentArrays, LinearAlgebra, Optimization, Test const nknots = 10 diff --git a/test/gdp_regression_test.jl b/test/gdp_regression_test.jl index 57db271aa..b0fe03cdb 100644 --- a/test/gdp_regression_test.jl +++ b/test/gdp_regression_test.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, Flux, OrdinaryDiffEq, LinearAlgebra, Test +using SciMLSensitivity, Flux, OrdinaryDiffEq, LinearAlgebra, Test GDP = [11394358246872.6, 11886411296037.9, 12547852149499.6, 13201781525927, 14081902622923.3, 14866223429278.3, 15728198883149.2, 16421593575529.9, 17437921118338, 18504710349537.1, 19191754995907.1, 20025063402734.2, 21171619915190.4, 22549236163304.4, 22999815176366.2, 23138798276196.2, 24359046058098.6, 25317009721600.9, 26301669369287.8, 27386035164588.8, 27907493159394.4, 28445139283067.1, 28565588996657.6, 29255060755937.6, 30574152048605.8, 31710451102539.4, 32786657119472.8, 34001004119223.5, 35570841010027.7, 36878317437617.5, 37952345258555.4, 38490918890678.7, 39171116855465.5, 39772082901255.8, 40969517920094.4, 42210614326789.4, 43638265675924.6, 45254805649669.6, 46411399944618.2, 47929948653387.3, 50036361141742.2, 51009550274808.6, 52127765360545.5, 53644090247696.9, 55995239099025.6, 58161311618934.2, 60681422072544.7, 63240595965946.1, 64413060738139.7, 63326658023605.9, 66036918504601.7, 68100669928597.9, 69811348331640.1, 71662400667935.7, 73698404958519.1, 75802901433146, 77752106717302.4, 80209237761564.8, 82643194654568.3] function monomial(cGDP, parameters, t) diff --git a/test/gpu/diffeqflux_standard_gpu.jl b/test/gpu/diffeqflux_standard_gpu.jl index b9271239a..db5797d97 100644 --- a/test/gpu/diffeqflux_standard_gpu.jl +++ b/test/gpu/diffeqflux_standard_gpu.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, OrdinaryDiffEq, Flux, DiffEqFlux, CUDA, Zygote +using SciMLSensitivity, OrdinaryDiffEq, Flux, DiffEqFlux, CUDA, Zygote CUDA.allowscalar(false) # Makes sure no slow operations are occuring # Generate Data diff --git a/test/gpu/mixed_gpu_cpu_adjoint.jl b/test/gpu/mixed_gpu_cpu_adjoint.jl index 26b8bb45e..7f08b9544 100644 --- a/test/gpu/mixed_gpu_cpu_adjoint.jl +++ b/test/gpu/mixed_gpu_cpu_adjoint.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, OrdinaryDiffEq +using SciMLSensitivity, OrdinaryDiffEq using Flux, CUDA, Test, Zygote, Random, LinearAlgebra CUDA.allowscalar(false) @@ -36,7 +36,7 @@ grad = Zygote.gradient(cost,p)[1] @test iszero(grad[6:end]) ### -# https://github.com/SciML/DiffEqSensitivity.jl/issues/632 +# https://github.com/SciML/SciMLSensitivity.jl/issues/632 ### rng = MersenneTwister(1234) diff --git a/test/hasbranching.jl b/test/hasbranching.jl index dccb2636a..025673de3 100644 --- a/test/hasbranching.jl +++ b/test/hasbranching.jl @@ -1,9 +1,9 @@ -using DiffEqSensitivity, Test +using SciMLSensitivity, Test -@test DiffEqSensitivity.hasbranching(1, 2) do x, y +@test SciMLSensitivity.hasbranching(1, 2) do x, y (x < 0 ? -x : x) + exp(y) end -@test !DiffEqSensitivity.hasbranching(1, 2) do x, y +@test !SciMLSensitivity.hasbranching(1, 2) do x, y ifelse(x < 0, -x, x) + exp(y) end diff --git a/test/hybrid_de.jl b/test/hybrid_de.jl index 1c5bdbf32..51e30127d 100644 --- a/test/hybrid_de.jl +++ b/test/hybrid_de.jl @@ -1,4 +1,4 @@ -using Flux, DiffEqSensitivity, DiffEqCallbacks, OrdinaryDiffEq, Test # , Plots +using Flux, SciMLSensitivity, DiffEqCallbacks, OrdinaryDiffEq, Test # , Plots u0 = Float32[2.; 0.] datasize = 100 diff --git a/test/layers.jl b/test/layers.jl index 92b474361..08b3084f4 100644 --- a/test/layers.jl +++ b/test/layers.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, Flux, Zygote, OrdinaryDiffEq, Test # , Plots +using SciMLSensitivity, Flux, Zygote, OrdinaryDiffEq, Test # , Plots function lotka_volterra(du,u,p,t) x, y = u diff --git a/test/layers_dde.jl b/test/layers_dde.jl index b4f05c12a..02095f736 100644 --- a/test/layers_dde.jl +++ b/test/layers_dde.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, Flux, Zygote, DelayDiffEq, Test +using SciMLSensitivity, Flux, Zygote, DelayDiffEq, Test ## Setup DDE to optimize function delay_lotka_volterra(du,u,h,p,t) diff --git a/test/layers_sde.jl b/test/layers_sde.jl index 867a02f59..55a43374e 100644 --- a/test/layers_sde.jl +++ b/test/layers_sde.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, Flux, Zygote, StochasticDiffEq, Test +using SciMLSensitivity, Flux, Zygote, StochasticDiffEq, Test function lotka_volterra(du,u,p,t) x, y = u diff --git a/test/literal_adjoint.jl b/test/literal_adjoint.jl index c28a7cede..4d39b4b1f 100644 --- a/test/literal_adjoint.jl +++ b/test/literal_adjoint.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, OrdinaryDiffEq, Zygote, Test +using SciMLSensitivity, OrdinaryDiffEq, Zygote, Test function lv!(du, u, p, t) x,y = u a, b, c, d = p diff --git a/test/mixed_costs.jl b/test/mixed_costs.jl index 74ed24018..9977ce36a 100644 --- a/test/mixed_costs.jl +++ b/test/mixed_costs.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity +using SciMLSensitivity using OrdinaryDiffEq using ForwardDiff, FiniteDiff, Zygote using QuadGK diff --git a/test/null_parameters.jl b/test/null_parameters.jl index 8cafc9ebe..0ac54e8b7 100644 --- a/test/null_parameters.jl +++ b/test/null_parameters.jl @@ -1,6 +1,6 @@ import OrdinaryDiffEq: ODEProblem, solve, Tsit5 import Zygote -using DiffEqSensitivity, Test +using SciMLSensitivity, Test dynamics = (x, _p, _t) -> x @@ -96,4 +96,4 @@ end @test_broken Zygote.gradient(loss7, zeros(123))[1] == zeros(123) @test Zygote.gradient(loss8, zeros(123))[1] == zeros(123) @test Zygote.gradient(loss9, zeros(123))[1] == zeros(123) -@test_throws DiffEqSensitivity.ZygoteVJPNothingError Zygote.gradient(loss10, zeros(123))[1] == zeros(123) +@test_throws SciMLSensitivity.ZygoteVJPNothingError Zygote.gradient(loss10, zeros(123))[1] == zeros(123) diff --git a/test/parameter_compatibility_errors.jl b/test/parameter_compatibility_errors.jl index 9f893cf02..e8ac92cf0 100644 --- a/test/parameter_compatibility_errors.jl +++ b/test/parameter_compatibility_errors.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, DiffEqSensitivity, Zygote, Test +using OrdinaryDiffEq, SciMLSensitivity, Zygote, Test function f!(du,u,p,t) du[1] = -p[1]'*u @@ -32,19 +32,19 @@ end grad(p) = Zygote.gradient(loss, p) p2 = [4;5;6] -@test_throws DiffEqSensitivity.ForwardDiffSensitivityParameterCompatibilityError grad(p2) +@test_throws SciMLSensitivity.ForwardDiffSensitivityParameterCompatibilityError grad(p2) function loss(p1) sol = solve(prob, Tsit5(), p=[p1, mystruct(-1,-2), control], sensealg = InterpolatingAdjoint()) return sum(abs2, sol) end -@test_throws DiffEqSensitivity.AdjointSensitivityParameterCompatibilityError grad(p2) +@test_throws SciMLSensitivity.AdjointSensitivityParameterCompatibilityError grad(p2) function loss(p1) sol = solve(prob, Tsit5(), p=[p1, mystruct(-1,-2), control], sensealg = ForwardSensitivity()) return sum(abs2, sol) end -@test_throws DiffEqSensitivity.ForwardSensitivityParameterCompatibilityError grad(p2) -@test_throws DiffEqSensitivity.ForwardSensitivityParameterCompatibilityError ODEForwardSensitivityProblem(f!,u0, tspan, p) \ No newline at end of file +@test_throws SciMLSensitivity.ForwardSensitivityParameterCompatibilityError grad(p2) +@test_throws SciMLSensitivity.ForwardSensitivityParameterCompatibilityError ODEForwardSensitivityProblem(f!,u0, tspan, p) \ No newline at end of file diff --git a/test/partial_neural.jl b/test/partial_neural.jl index 3ee23d6ec..0f44f24ef 100644 --- a/test/partial_neural.jl +++ b/test/partial_neural.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, Flux, Optimization, OptimizationFlux, OptimizationOptimJL, OrdinaryDiffEq, Test +using SciMLSensitivity, Flux, Optimization, OptimizationFlux, OptimizationOptimJL, OrdinaryDiffEq, Test x = Float32[0.8; 0.8] diff --git a/test/prob_kwargs.jl b/test/prob_kwargs.jl index 2ad499470..ec39de417 100644 --- a/test/prob_kwargs.jl +++ b/test/prob_kwargs.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, DiffEqSensitivity +using OrdinaryDiffEq, SciMLSensitivity function growth(du, u, p, t) @. du = p * u * (1 - u) diff --git a/test/rode.jl b/test/rode.jl index 02a683668..fd146d601 100644 --- a/test/rode.jl +++ b/test/rode.jl @@ -1,5 +1,5 @@ using StochasticDiffEq -using DiffEqSensitivity +using SciMLSensitivity using DiffEqNoiseProcess using LinearAlgebra, Statistics, Random using Zygote, ReverseDiff, ForwardDiff diff --git a/test/runtests.jl b/test/runtests.jl index 4f4786663..bceb33a78 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, SafeTestsets +using SciMLSensitivity, SafeTestsets using Test, Pkg const GROUP = get(ENV, "GROUP", "All") diff --git a/test/save_idxs.jl b/test/save_idxs.jl index a77d6a25f..72fe70bc6 100644 --- a/test/save_idxs.jl +++ b/test/save_idxs.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, DiffEqSensitivity, Zygote, ForwardDiff, Test +using OrdinaryDiffEq, SciMLSensitivity, Zygote, ForwardDiff, Test function lotka_volterra!(du, u, p, t) x, y = u diff --git a/test/sde_checkpointing.jl b/test/sde_checkpointing.jl index 4f1d7d851..ef5c7ca15 100644 --- a/test/sde_checkpointing.jl +++ b/test/sde_checkpointing.jl @@ -1,5 +1,5 @@ using Test, LinearAlgebra -using DiffEqSensitivity, StochasticDiffEq +using SciMLSensitivity, StochasticDiffEq using Random @info "SDE Checkpointing" diff --git a/test/sde_neural.jl b/test/sde_neural.jl index fdccf71da..5b1b61519 100644 --- a/test/sde_neural.jl +++ b/test/sde_neural.jl @@ -1,8 +1,8 @@ -using DiffEqSensitivity, Flux, LinearAlgebra +using SciMLSensitivity, Flux, LinearAlgebra using DiffEqNoiseProcess using StochasticDiffEq using Statistics -using DiffEqSensitivity +using SciMLSensitivity using DiffEqBase.EnsembleAnalysis using Zygote using Optimization, OptimizationFlux diff --git a/test/sde_nondiag_stratonovich.jl b/test/sde_nondiag_stratonovich.jl index 2d9670d06..ba8219b7f 100644 --- a/test/sde_nondiag_stratonovich.jl +++ b/test/sde_nondiag_stratonovich.jl @@ -1,5 +1,5 @@ using Test, LinearAlgebra -using DiffEqSensitivity, StochasticDiffEq +using SciMLSensitivity, StochasticDiffEq using ForwardDiff, Zygote using Random diff --git a/test/sde_scalar_ito.jl b/test/sde_scalar_ito.jl index 6d66d53f6..0c6f64e65 100644 --- a/test/sde_scalar_ito.jl +++ b/test/sde_scalar_ito.jl @@ -1,5 +1,5 @@ using Test, LinearAlgebra -using DiffEqSensitivity, StochasticDiffEq +using SciMLSensitivity, StochasticDiffEq using Random using DiffEqNoiseProcess using ForwardDiff @@ -90,7 +90,7 @@ gs_u0, gs_p = adjoint_sensitivities(solIto,EM(),t=Array(t),dg_discrete=dg!, @info gs_u0, gs_p gs_u0a, gs_pa = adjoint_sensitivities(solIto,EM(),t=Array(t),dg_discrete=dg!, - dt=dt,adaptive=false,sensealg=BacksolveAdjoint(autojacvec=DiffEqSensitivity.ReverseDiffVJP())) + dt=dt,adaptive=false,sensealg=BacksolveAdjoint(autojacvec=SciMLSensitivity.ReverseDiffVJP())) @info gs_u0a, gs_pa diff --git a/test/sde_scalar_stratonovich.jl b/test/sde_scalar_stratonovich.jl index d841a3fc0..67481467f 100644 --- a/test/sde_scalar_stratonovich.jl +++ b/test/sde_scalar_stratonovich.jl @@ -1,5 +1,5 @@ using Test, LinearAlgebra -using DiffEqSensitivity, StochasticDiffEq +using SciMLSensitivity, StochasticDiffEq using Random @info "SDE Adjoints" diff --git a/test/sde_stratonovich.jl b/test/sde_stratonovich.jl index ff1bd48fe..60b9823be 100644 --- a/test/sde_stratonovich.jl +++ b/test/sde_stratonovich.jl @@ -1,6 +1,6 @@ using Test, LinearAlgebra using OrdinaryDiffEq -using DiffEqSensitivity, StochasticDiffEq, DiffEqBase +using SciMLSensitivity, StochasticDiffEq, DiffEqBase using ForwardDiff, ReverseDiff using Random import Tracker, Zygote diff --git a/test/sde_transformation_test.jl b/test/sde_transformation_test.jl index 9f9f78041..9650fcf9b 100644 --- a/test/sde_transformation_test.jl +++ b/test/sde_transformation_test.jl @@ -1,5 +1,5 @@ using Test, LinearAlgebra -using DiffEqSensitivity, StochasticDiffEq +using SciMLSensitivity, StochasticDiffEq using Random @info "Test SDE Transformation" diff --git a/test/second_order.jl b/test/second_order.jl index d6487d4e7..df58906f6 100644 --- a/test/second_order.jl +++ b/test/second_order.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, OrdinaryDiffEq, DiffEqBase, ForwardDiff +using SciMLSensitivity, OrdinaryDiffEq, DiffEqBase, ForwardDiff using Test function fb(du,u,p,t) diff --git a/test/second_order_odes.jl b/test/second_order_odes.jl index 7634ab4b9..910f3e5ee 100644 --- a/test/second_order_odes.jl +++ b/test/second_order_odes.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, DiffEqSensitivity, Zygote, RecursiveArrayTools, Test +using OrdinaryDiffEq, SciMLSensitivity, Zygote, RecursiveArrayTools, Test u0 = Float32[1.; 2.] du0 = Float32[0.; 2.] diff --git a/test/shadowing.jl b/test/shadowing.jl index a01a4a846..ab0a8bcaa 100644 --- a/test/shadowing.jl +++ b/test/shadowing.jl @@ -1,7 +1,7 @@ using Random; Random.seed!(1238) using OrdinaryDiffEq using Statistics -using DiffEqSensitivity +using SciMLSensitivity using Test using Zygote @@ -30,13 +30,13 @@ using Zygote end lss_problem1 = ForwardLSSProblem(sol_attractor, ForwardLSS(g=g)) lss_problem1a = ForwardLSSProblem(sol_attractor, ForwardLSS(g=g), dg_continuous = dg) - lss_problem2 = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=DiffEqSensitivity.Cos2Windowing(),g=g)) - lss_problem2a = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=DiffEqSensitivity.Cos2Windowing()), dg_continuous = dg) - lss_problem3 = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)) - lss_problem3a = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g), dg_continuous = dg) #ForwardLSS with time dilation requires knowledge of g + lss_problem2 = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=SciMLSensitivity.Cos2Windowing(),g=g)) + lss_problem2a = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=SciMLSensitivity.Cos2Windowing()), dg_continuous = dg) + lss_problem3 = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)) + lss_problem3a = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g), dg_continuous = dg) #ForwardLSS with time dilation requires knowledge of g - adjointlss_problem = AdjointLSSProblem(sol_attractor, AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)) - adjointlss_problem_a = AdjointLSSProblem(sol_attractor, AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g), dg_continuous = dg) + adjointlss_problem = AdjointLSSProblem(sol_attractor, AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)) + adjointlss_problem_a = AdjointLSSProblem(sol_attractor, AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g), dg_continuous = dg) res1 = shadow_forward(lss_problem1) res1a = shadow_forward(lss_problem1a) @@ -62,13 +62,13 @@ using Zygote sol_attractor2 = solve(prob_attractor,Vern9(),abstol=1e-14,reltol=1e-14, saveat=0.01) lss_problem1 = ForwardLSSProblem(sol_attractor2, ForwardLSS(g=g)) lss_problem1a = ForwardLSSProblem(sol_attractor2, ForwardLSS(g=g), dg_continuous = dg) - lss_problem2 = ForwardLSSProblem(sol_attractor2, ForwardLSS(LSSregularizer=DiffEqSensitivity.Cos2Windowing(),g=g)) - lss_problem2a = ForwardLSSProblem(sol_attractor2, ForwardLSS(LSSregularizer=DiffEqSensitivity.Cos2Windowing()), dg_continuous = dg) - lss_problem3 = ForwardLSSProblem(sol_attractor2, ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)) - lss_problem3a = ForwardLSSProblem(sol_attractor2, ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g), dg_continuous = dg) #ForwardLSS with time dilation requires knowledge of g + lss_problem2 = ForwardLSSProblem(sol_attractor2, ForwardLSS(LSSregularizer=SciMLSensitivity.Cos2Windowing(),g=g)) + lss_problem2a = ForwardLSSProblem(sol_attractor2, ForwardLSS(LSSregularizer=SciMLSensitivity.Cos2Windowing()), dg_continuous = dg) + lss_problem3 = ForwardLSSProblem(sol_attractor2, ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)) + lss_problem3a = ForwardLSSProblem(sol_attractor2, ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g), dg_continuous = dg) #ForwardLSS with time dilation requires knowledge of g - adjointlss_problem = AdjointLSSProblem(sol_attractor2, AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)) - adjointlss_problem_a = AdjointLSSProblem(sol_attractor2, AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g), dg_continuous = dg) + adjointlss_problem = AdjointLSSProblem(sol_attractor2, AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)) + adjointlss_problem_a = AdjointLSSProblem(sol_attractor2, AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g), dg_continuous = dg) res1 = shadow_forward(lss_problem1) res1a = shadow_forward(lss_problem1a) @@ -99,13 +99,13 @@ using Zygote dp1 = Zygote.gradient((p)->G(p),p) @test res1 ≈ dp1[1] atol=1e-10 - dp1 = Zygote.gradient((p)->G(p, sensealg=ForwardLSS(LSSregularizer=DiffEqSensitivity.Cos2Windowing())),p) + dp1 = Zygote.gradient((p)->G(p, sensealg=ForwardLSS(LSSregularizer=SciMLSensitivity.Cos2Windowing())),p) @test res2 ≈ dp1[1] atol=1e-10 - dp1 = Zygote.gradient((p)->G(p, sensealg=ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)),p) + dp1 = Zygote.gradient((p)->G(p, sensealg=ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)),p) @test res3 ≈ dp1[1] atol=1e-10 - dp1 = Zygote.gradient((p)->G(p, sensealg=AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)),p) + dp1 = Zygote.gradient((p)->G(p, sensealg=AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)),p) @test res4 ≈ dp1[1] atol=1e-10 @show res1[1] res2[1] res3[1] @@ -137,10 +137,10 @@ using Zygote fill!(out, one(eltype(p))) end - lss_problem = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)) - lss_problem_a = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g), dg_continuous = (dgu,dgp)) - adjointlss_problem = AdjointLSSProblem(sol_attractor, AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)) - adjointlss_problem_a = AdjointLSSProblem(sol_attractor, AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g), dg_continuous = (dgu,dgp)) + lss_problem = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)) + lss_problem_a = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g), dg_continuous = (dgu,dgp)) + adjointlss_problem = AdjointLSSProblem(sol_attractor, AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)) + adjointlss_problem_a = AdjointLSSProblem(sol_attractor, AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g), dg_continuous = (dgu,dgp)) resfw = shadow_forward(lss_problem) resfw_a = shadow_forward(lss_problem_a) @@ -152,7 +152,7 @@ using Zygote @test resfw ≈ resadj_a rtol=1e-10 sol_attractor2 = solve(prob_attractor,Vern9(),abstol=1e-14,reltol=1e-14, saveat=0.01) - lss_problem = ForwardLSSProblem(sol_attractor2, ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)) + lss_problem = ForwardLSSProblem(sol_attractor2, ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)) resfw = shadow_forward(lss_problem) function G(p; sensealg=ForwardLSS(), dt=0.01) @@ -161,10 +161,10 @@ using Zygote sum(getindex.(_sol.u,3)) + sum(p) end - dp1 = Zygote.gradient((p)->G(p, sensealg=ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)),p) + dp1 = Zygote.gradient((p)->G(p, sensealg=ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)),p) @test resfw ≈ dp1[1] atol=1e-10 - dp1 = Zygote.gradient((p)->G(p, sensealg=AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)),p) + dp1 = Zygote.gradient((p)->G(p, sensealg=AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)),p) @test resfw ≈ dp1[1] atol=1e-10 @show resfw @@ -204,50 +204,50 @@ using Zygote ## ForwardLSS - lss_problem = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0), g=g)) + lss_problem = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0), g=g)) resfw = shadow_forward(lss_problem) res = deepcopy(resfw) - dp1 = Zygote.gradient((p)->G(p, sensealg=ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)),p) + dp1 = Zygote.gradient((p)->G(p, sensealg=ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)),p) @test res ≈ dp1[1] atol=1e-10 - resfw = shadow_forward(lss_problem, sensealg = ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0,10.0,5.0), g=g)) + resfw = shadow_forward(lss_problem, sensealg = ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0,10.0,5.0), g=g)) resskip = deepcopy(resfw) - dp1 = Zygote.gradient((p)->G(p, sensealg=ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0,10.0,5.0), g=g)),p) + dp1 = Zygote.gradient((p)->G(p, sensealg=ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0,10.0,5.0), g=g)),p) @test resskip ≈ dp1[1] atol=1e-10 @show res resskip ## ForwardLSS with dgdu and dgdp - lss_problem = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g), dg_continuous = (dgu,dgp)) + lss_problem = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g), dg_continuous = (dgu,dgp)) res2 = shadow_forward(lss_problem) @test res ≈ res2 atol=1e-10 - res2 = shadow_forward(lss_problem, sensealg = ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0,10.0,5.0), g=g)) + res2 = shadow_forward(lss_problem, sensealg = ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0,10.0,5.0), g=g)) @test resskip ≈ res2 atol=1e-10 ## AdjointLSS - lss_problem = AdjointLSSProblem(sol_attractor, AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)) + lss_problem = AdjointLSSProblem(sol_attractor, AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)) res2 = shadow_adjoint(lss_problem) @test res ≈ res2 atol=1e-10 - res2 = shadow_adjoint(lss_problem, sensealg = AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0,10.0,5.0), g=g)) + res2 = shadow_adjoint(lss_problem, sensealg = AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0,10.0,5.0), g=g)) @test_broken resskip ≈ res2 atol=1e-10 - dp1 = Zygote.gradient((p)->G(p, sensealg=AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)),p) + dp1 = Zygote.gradient((p)->G(p, sensealg=AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)),p) @test res ≈ dp1[1] atol=1e-10 - dp1 = Zygote.gradient((p)->G(p, sensealg=AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0,10.0,5.0), g=g)),p) + dp1 = Zygote.gradient((p)->G(p, sensealg=AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0,10.0,5.0), g=g)),p) @test res2 ≈ dp1[1] atol=1e-10 ## AdjointLSS with dgdu and dgd - lss_problem = AdjointLSSProblem(sol_attractor, AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0), g=g), dg_continuous = (dgu,dgp)) + lss_problem = AdjointLSSProblem(sol_attractor, AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0), g=g), dg_continuous = (dgu,dgp)) res2 = shadow_adjoint(lss_problem) @test res ≈ res2 atol=1e-10 - res2 = shadow_adjoint(lss_problem, sensealg = AdjointLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0,10.0,5.0), g=g)) + res2 = shadow_adjoint(lss_problem, sensealg = AdjointLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0,10.0,5.0), g=g)) @test_broken resskip ≈ res2 atol=1e-10 end end @@ -282,11 +282,11 @@ end # are initialized randomly Random.seed!(1234) nilss_prob1 = NILSSProblem(prob_attractor, NILSS(nseg, nstep, g=g)) - res1 = DiffEqSensitivity.shadow_forward(nilss_prob1,Tsit5()) + res1 = SciMLSensitivity.shadow_forward(nilss_prob1,Tsit5()) Random.seed!(1234) nilss_prob2 = NILSSProblem(prob_attractor, NILSS(nseg, nstep, g=g), dg_continuous = dg) - res2 = DiffEqSensitivity.shadow_forward(nilss_prob2,Tsit5()) + res2 = SciMLSensitivity.shadow_forward(nilss_prob2,Tsit5()) @test res1[1] ≈ 1 atol=5e-2 @test res2[1] ≈ 1 atol=5e-2 @@ -327,7 +327,7 @@ end g(u,p,t) = u[end] - lss_problem = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0),g=g)) + lss_problem = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0),g=g)) resfw = shadow_forward(lss_problem) @@ -362,7 +362,7 @@ end M = 2 nseg = 2 numparams = 1 - quadcache = DiffEqSensitivity.QuadratureCache(u0, M, nseg, numparams) + quadcache = SciMLSensitivity.QuadratureCache(u0, M, nseg, numparams) C = quadcache.C C[:,:,1] .= [ @@ -396,7 +396,7 @@ end b[:,1] = [Inf, Inf] b[:,2] = [0., 1.] - @test DiffEqSensitivity.nilsas_min(quadcache) ≈ [-1. 0. + @test SciMLSensitivity.nilsas_min(quadcache) ≈ [-1. 0. -1. -1.] end @testset "Lorenz" begin @@ -431,7 +431,7 @@ end out[end] = one(eltype(u)) end - lss_problem = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0), g=g), dg_continuous = dg) + lss_problem = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0), g=g), dg_continuous = dg) resfw = shadow_forward(lss_problem) @info resfw @@ -486,7 +486,7 @@ end fill!(out, one(eltype(p))) end - lss_problem = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=DiffEqSensitivity.TimeDilation(10.0), g=g), dg_continuous = (dgu,dgp)) + lss_problem = ForwardLSSProblem(sol_attractor, ForwardLSS(LSSregularizer=SciMLSensitivity.TimeDilation(10.0), g=g), dg_continuous = (dgu,dgp)) resfw = shadow_forward(lss_problem) @info resfw diff --git a/test/size_handling_adjoint.jl b/test/size_handling_adjoint.jl index b0f820f04..0412a19c8 100644 --- a/test/size_handling_adjoint.jl +++ b/test/size_handling_adjoint.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, Flux, OrdinaryDiffEq, Test # , Plots +using SciMLSensitivity, Flux, OrdinaryDiffEq, Test # , Plots p = [1.5 1.0;3.0 1.0] function lotka_volterra(du,u,p,t) diff --git a/test/sparse_adjoint.jl b/test/sparse_adjoint.jl index 7d8f65b55..c473bd7e5 100644 --- a/test/sparse_adjoint.jl +++ b/test/sparse_adjoint.jl @@ -1,4 +1,4 @@ -using DiffEqSensitivity, OrdinaryDiffEq, LinearAlgebra, SparseArrays, Zygote, LinearSolve +using SciMLSensitivity, OrdinaryDiffEq, LinearAlgebra, SparseArrays, Zygote, LinearSolve using AlgebraicMultigrid: AlgebraicMultigrid using Test diff --git a/test/steady_state.jl b/test/steady_state.jl index a3478c318..414741003 100644 --- a/test/steady_state.jl +++ b/test/steady_state.jl @@ -1,5 +1,5 @@ using Test, LinearAlgebra -using DiffEqSensitivity, SteadyStateDiffEq, DiffEqBase, NLsolve +using SciMLSensitivity, SteadyStateDiffEq, DiffEqBase, NLsolve using OrdinaryDiffEq using ForwardDiff, Calculus using Random diff --git a/test/stiff_adjoints.jl b/test/stiff_adjoints.jl index 112037950..3b4948926 100644 --- a/test/stiff_adjoints.jl +++ b/test/stiff_adjoints.jl @@ -1,4 +1,4 @@ -using Zygote, DiffEqSensitivity +using Zygote, SciMLSensitivity println("Starting tests") using OrdinaryDiffEq, ForwardDiff, Test diff --git a/test/time_type_mixing.jl b/test/time_type_mixing.jl index 6c36b9fd0..4f08215bf 100644 --- a/test/time_type_mixing.jl +++ b/test/time_type_mixing.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq, Zygote, DiffEqSensitivity, Test +using OrdinaryDiffEq, Zygote, SciMLSensitivity, Test p_model = [1f0] @@ -21,7 +21,7 @@ p_model_ini = copy(p_model) @test !iszero(Zygote.gradient(loss,p_model_ini)[1]) -## https://github.com/SciML/DiffEqSensitivity.jl/issues/675 +## https://github.com/SciML/SciMLSensitivity.jl/issues/675 u0 = Float32[2.0; 0.0] # Initial condition p = [-0.1 2.0; -2.0 -0.1]