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
julia> JET.@report_opt u([1.],1.) | |
═════ 77 possible errors found ═════ | |
┌ @ /home/htc/bzfsikor/code/OptImpSampling.jl/src/control.jl:137 dlogz = fgrad(#148, x) | |
│┌ @ /home/htc/bzfsikor/code/OptImpSampling.jl/src/ociso.jl:25 ForwardDiff.gradient(f, x) | |
││┌ @ /home/htc/bzfsikor/.julia/packages/ForwardDiff/pDtsf/src/gradient.jl:17 ForwardDiff.GradientConfig(f, x) | |
│││┌ @ /home/htc/bzfsikor/.julia/packages/ForwardDiff/pDtsf/src/config.jl:121 ForwardDiff.Chunk(x) | |
││││┌ @ /home/htc/bzfsikor/.julia/packages/ForwardDiff/pDtsf/src/prelude.jl:26 #self#(x, ForwardDiff.DEFAULT_CHUNK_THRESHOLD) | |
│││││┌ @ /home/htc/bzfsikor/.julia/packages/ForwardDiff/pDtsf/src/prelude.jl:26 ForwardDiff.Chunk(ForwardDiff.length(x), threshold) | |
││││││┌ @ /home/htc/bzfsikor/.julia/packages/ForwardDiff/pDtsf/src/prelude.jl:22 %13() | |
│││││││ runtime dispatch detected: %13::Type{ForwardDiff.Chunk{_A}} where _A()::ForwardDiff.Chunk |
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
# basically a type stable version of memoize.jl with a 1-element dict/cache | |
# it would be nice however to be able to only call cachedf = cache(f) | |
# such that cachedf would be typle stable. | |
# so far i have no idea how to achieve this | |
mutable struct CachedFunction{F, I, O} | |
f::F | |
in::I | |
out::O | |
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
#https://github.com/FluxML/Zygote.jl/issues/1294 | |
using Zygote | |
using StochasticDiffEq, SciMLSensitivity | |
using StatsBase | |
import Lux | |
function mwe() | |
x0 = rand(1) | |
p0 = rand(1) |
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
# https://github.com/SciML/SciMLSensitivity.jl/issues/720 | |
using Zygote | |
using StochasticDiffEq, SciMLSensitivity | |
function mwe1() | |
x0 = [0.] | |
drift(dx, x, p, t) = (dx .= p) | |
noise(dx, x, p, t) = (dx .= 0.) | |
n0 = zeros(1,1) | |
T = 100. |
This file has been truncated, but you can view the full file.
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
ERROR: Event was triggered but no corresponding event in ContinuousCallback was found. Please report this error. | |
Stacktrace: | |
[1] error(s::String) | |
@ Base ./error.jl:35 | |
[2] get_indx(cb::ContinuousCallback{var"#9#10"{Int64, Int64}, SciMLSensitivity.TrackedAffect{Float64, Vector{Float64}, ComponentArrays.ComponentVector{Float32, Vector{Float32}, Tuple{ComponentArrays.Axis{(layer_1 = ViewAxis(1:20, Axis(weight = ViewAxis(1:10, ShapedAxis((10, 1), NamedTuple())), bias = ViewAxis(11:20, ShapedAxis((10, 1), NamedTuple())))), layer_2 = ViewAxis(21:31, Axis(weight = ViewAxis(1:10, ShapedAxis((1, 10), NamedTuple())), bias = ViewAxis(11:11, ShapedAxis((1, 1), NamedTuple())))))}}}, typeof(terminate!), SciMLSensitivity.ImplicitCorrection{Vector{Float64}, Vector{Float64}, SciMLSensitivity.ConditionTimeWrapper{var"#9#10"{Int64, Int64}, Vector{Float64}, SciMLSensitivity.FakeIntegrator{Vector{Float64}, ComponentArrays.ComponentVector{Float32, Vector{Float32}, Tuple{ComponentArrays.Axis{(layer_1 = ViewAxis(1:20, Axis(we |
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
import numpy as np | |
t_adopt = .5 | |
p_adopt = .9 | |
p_expl = .1 | |
def timestep(state, influence): | |
influenced = (np.abs(np.dot(influence,state)) > t_adopt) | |
r = np.random.rand(np.size(state)) | |
# vectorized: 415us |
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
using Sundials | |
function test1() | |
yS0 = [1. 2. 3.; 4. 5 6] | |
N, Ns = size(yS0) | |
GC.@preserve yS0n = [Sundials.NVector(yS0[:,j]) for j=1:Ns] # array of julia wrappers | |
GC.@preserve yS0nv = [Sundials.N_Vector(n) for n in yS0n] # array of pointers to sund. structs | |
pyS0 = pointer(yS0nv) |
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
using Sundials | |
using Sundials: N_Vector, N_Vector_S | |
using ForwardDiff | |
#using ReverseDiff | |
""" | |
sens(f!, t0, y0, p, tout; reltol, abstol) | |
Compute the solution and sensivities to the parametrized ODE problem defined by `f!(ẏ, t, y, p)`, starting at t0, y0, p. |
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
using Plots | |
rect(x,y,w,h) = Shape(x+[0,w,w,0], y+[0,0,h,h]) | |
@recipe function f(ds::Array{Measurement}; alpha = 1) | |
isempty(ds) && return [] | |
binedges = [0,10,12,14,16,18,20,25] | |
nmax = nfollicles(ds) | |
a = alpha |
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
heu |
NewerOlder