Skip to content

Instantly share code, notes, and snippets.

View oxinabox's full-sized avatar
🐂

Frames White oxinabox

🐂
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@marcrasi
marcrasi / aunifying.md
Last active February 25, 2021 13:25
Unifying the differentiation modes

Unifying the differentiation modes

Today, Swift AD has two separate transforms that produce forward mode derivatives (JVPs) and reverse mode derivatives (VJPs).

We can generalize this to a single transform that produces a single "derivative function" that can evaluate derivatives in both modes.

The "derivative function" is generic over a "derivative type" that determines the derivative mode.

The advantages over the existing system are:

@ChrisRackauckas
ChrisRackauckas / diffeqflux_differentialequations_vs_torchdiffeq_results.md
Last active December 20, 2023 13:10
torchdiffeq (Python) vs DifferentialEquations.jl (Julia) ODE Benchmarks (Neural ODE Solvers)

Torchdiffeq vs DifferentialEquations.jl (/ DiffEqFlux.jl) Neural ODE Compatible Solver Benchmarks

Only non-stiff ODE solvers are tested since torchdiffeq does not have methods for stiff ODEs. The ODEs are chosen to be representative of models seen in physics and model-informed drug development (MIDD) studies (quantiative systems pharmacology) in order to capture the performance on realistic scenarios.

Summary

Below are the timings relative to the fastest method (lower is better). For approximately 1 million ODEs and less, torchdiffeq was more than an order of magnitude slower than DifferentialEquations.jl

@ZacLN
ZacLN / staticlintjunk.jl
Created July 3, 2018 16:05
scoping example
str = """
using Base.Test
@testset "ts1" begin
x=1
x==1
end
@testset "ts2" begin
x=2
x==1
# To ensure correct alignment (e.g. for an 80-bit type)
struct StrWrap{T}
value::T
end
function unsafe_reinterpret(T, a::A) where {A}
if sizeof(T) <= sizeof(A)
r = Ref(a)
Base.@gc_preserve r begin
u = convert(Ptr{T}, Base.unsafe_convert(Ptr{A}, r))
@musm
musm / break.jl
Last active March 10, 2020 21:25
Break Julia for fun (segfault/stackoverflows/etc.)
# credits: @TotalVerb, @oxinabox, @musm @mbauman @quinnj
julia --compile=no --precompiled=no
(x->@inbounds(x+=[0][x])+x)(9^9^9)
[@inbounds([][x])for x=9^9^9]
run(`1`)
@takluyver
takluyver / ipytables.py
Created March 6, 2013 11:57
IPyTables
class TableCell(object):
bg_colour = None
def __init__(self, value, header=False, bg_colour=None, text_colour=None):
self.value = value
self.header = header
self.bg_colour = bg_colour
self.text_colour = text_colour
def _make_css(self):