Skip to content

Instantly share code, notes, and snippets.

View devmotion's full-sized avatar
On vacation

David Widmann devmotion

On vacation
View GitHub Profile
devmotion / Manifest.toml
Created June 25, 2023 10:57
Enzyme segfaults with Turing
# This file is machine-generated - editing it directly is not advised
julia_version = "1.9.1"
manifest_format = "2.0"
project_hash = "65efc28519b1ed70299db030b3148e218b921e6a"
git-tree-sha1 = "dcfdf328328f2645531c4ddebf841228aef74130"
uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
version = "0.1.3"
devmotion / log.txt
Created September 28, 2022 10:38
Turing Enzyme
112,0,0,16,22]:Integer, [112,0,0,16,23]:Integer, [112,0,0,16,24]:Integer, [112,0,0,16,25]:Integer, [112,0,0,16,26]:Integer, [112,0,0,16,27]:Integer, [112,0,0,16,28]:Integer, [112,0,0,16,29]:Integer, [112,0,0,16,30]:Integer, [112,0,0,16,31]:Integer, [112,0,0,16,32]:Integer, [112,0,0,16,33]:Integer, [112,0,0,16,34]:Integer, [112,0,0,16,35]:Integer, [112,0,0,16,36]:Integer, [112,0,0,16,37]:Integer, [112,0,0,16,38]:Integer, [112,0,0,16,39]:Integer, [112,0,0,16,40]:Integer, [112,0,0,24]:Integer, [112,0,0,25]:Integer, [112,0,0,26]:Integer, [112,0,0,27]:Integer, [112,0,0,28]:Integer, [112,0,0,29]:Integer, [112,0,0,30]:Integer, [112,0,0,31]:Integer, [112,0,0,32]:Integer, [112,0,0,33]:Integer, [112,0,0,34]:Integer, [112,0,0,35]:Integer, [112,0,0,36]:Integer, [112,0,0,37]:Integer, [112,0,0,38]:Integer, [112,0,0,39]:Integer, [112,0,0,40]:Integer, [112,0,0,41]:Integer, [112,0,0,42]:Integer, [112,0,0,43]:Integer, [112,0,0,44]:Integer, [112,0,0,45]:Integer, [112,0,0,46]:Integer, [112,0,0,47]:Integer, [112,0,0,48]:Integer,
* One-pass algorithm of `log_sum_exp`.
function log_sum_exp_onepass(x:Real[_]) -> Real {
if length(x) > 0 {
let (mx, r) <- transform_reduce(x, (-inf, 0.0),
\(x:(Real, Real), y:(Real, Real)) -> {
let (xa, xb) <- x;
let (ya, yb) <- y;
if xa > ya {
┌ Warning: dt(2.220446049250313e-16) <= dtmin(2.220446049250313e-16) at t=4.2228999661198057e-16. Aborting. There is either an error in your model specification or the true solution is unstable.
└ @ SciMLBase /home/david/.julia/packages/SciMLBase/koNdH/src/integrator_interface.jl:366
Sampling 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| Time: 0:00:09
ERROR: DimensionMismatch("arrays could not be broadcast to a common size; got a dimension with lengths 120 and 6120")
[1] _bcs1
@ ./broadcast.jl:516 [inlined]
[2] _bcs
@ ./broadcast.jl:510 [inlined]
[3] broadcast_shape
julia> using DynamicPPL
julia> @model function demo4(n, ::Type{TV}=Vector{Float64}) where {TV}
m ~ Normal()
x = TV(undef, n)
@show __varinfo__
for i in eachindex(x)
x[i] ~ Normal(m, 1.0)
using BenchmarkTools
using Distances
using Distributions
using StatsBase
using LinearAlgebra
using SparseArrays
function f(
c, μ::DiscreteNonParametric, ν::DiscreteNonParametric, plan::SparseMatrixCSC
devmotion / ot.jl
Created May 24, 2021 19:09
Discrete OT
using Distributions
using SparseArrays
using LinearAlgebra
using StatsBase
function _ot_cost_plan(c, μ::DiscreteNonParametric, ν::DiscreteNonParametric; get=:plan)
len_μ = length(μ.p)
len_ν = length(ν.p)
wi = μ.p[1]
wj = ν.p[1]
using AdvancedMH
using ArraysOfArrays
using CairoMakie
using DiffEqNoiseProcess
using Distributions
using StochasticDiffEq
using Turing
using Random
struct CrankNicolsonProposal{P,T} <: AdvancedMH.Proposal{P}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
using Turing
using Turing.RandomMeasures
using Random
function stickbreaking(rpm = DirichletProcess(0.25))
# Data
data = [-2,2,-1.5,1.5]
# Base distribution