Skip to content

Instantly share code, notes, and snippets.

View jrevels's full-sized avatar

Jarrett Revels jrevels

View GitHub Profile
using ReverseDiff, ForwardDiff
x, v = rand(3), rand(3)
tp = ReverseDiff.InstructionTape()
tx = ReverseDiff.track(x, tp)
ty = cumprod(tx)
ReverseDiff.increment_deriv!(ty, v)
ReverseDiff.reverse_pass!(tp)
# NOTE: Make sure to run this in a "fresh" session. If the method you're invoking
# has already been compiled, then the compiler might grab its old results instead
# of populating the cache we're constructing here.
mymethod = # callable value you want to check
mysig = Tuple{typeof(mymethod), #= types of arguments here =#}
p = Core.Compiler.Params(typemax(UInt))
Core.Compiler.typeinf_code(methods(mymethod).ms[end], mysig, Core.svec(), false, p)
Core.show(map(((i, x),) -> (i, x.result, x.linfo), enumerate(p.cache)))
using ForwardDiff, ReverseDiff, BenchmarkTools
n = 100
x = rand(n)
v = rand(n)
tape = ReverseDiff.compile(ReverseDiff.GradientTape(cumprod, rand(n)))
vJ = rand(n)'
function vecjacobian_new!(vJ, v, tape, x)
input = ReverseDiff.input_hook(tape)
using ForwardDiff, ReverseDiff, BenchmarkTools
mutable struct MyJacobianWrapper{fType,tType} <: Function
f::fType
t::tType
end
function (ff::MyJacobianWrapper)(u, p)
du1 = similar(p, size(u))
ff.f(du1,u,p,ff.t)
using Cassette, Test
using Cassette: @context, enabletagging, @overdub, overdub, recurse,
hasmetadata, metadata, tag, untag
using ChainRules: frule, Zero, extern
@context DiffCtx
Cassette.metadatatype(::Type{<:DiffCtx}, ::Type{T}) where {T<:Real} = T
function D(f, x)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDXOxV75iMypd/IrDZWz0zRX9EpLz7Bfk0C+qBFkqumir6FAJaBVwiL2PcwwOjMt8MgUNNxEvjs8PIEjDw8FefYT+TfIRXHGWKclZ8HuXyP54pR/pgjpYG9nUBt3DZVTZk5rynVmZEXQSgeHes5+3+31rEhaNhIc/vmTTUGZWS6ejvQe8vSfDGuLWnwpGtgiOIZNck4fq0ZAu9yje7O/VIhHCS6slKKN4iwwx1KS+UD2TMrXVot1JS5STiamGfVgxqAncOH4U+LrzCJWrJ8rncQu3+fSjmaUYKbiOlApL9y3nJQkRAUYgdNITUZcsn/2rYuPkjns2tP1X1g++szASeIRCFKfScnMRndt7/L3mHbn398+wUBLW74XuZsVVB4Fi54AxAbACjcN5blQ+IkbZCIZc4Mu+cOYrKFASN2YozW0R/VthdDuzeXEHPKtYPoYXKoxmopwiN9TTJAlAs/afaOdSjSYNLV8SHQfSzVR/nmWkUntHfj2bwhANNjZwzEClNU79WKi9CVIj3HQv5DcWDDfZFnZlDvPXyNNkT9qHpOhkrYqfpNUCKGHP8eitNbTZm8zzipm0Sx5OhJk+uZBt9zBxoIQoFYxEgdQ2pFk1TzvbAEMv6Y8/EL0YGa2HJBcLZAvSWtxho7DyqW0ehGGV5/7X+JakEcEHu129QQw5pSZQ== [email protected]
using MsgPack, BenchmarkTools
struct MyType
a::Vector{Symbol}
b::Symbol
c::Float64
d::String
e::UInt64
f::Symbol
g::Union{Nothing,Dict{Symbol,Any}}
using CuArrays
using CuArrays: CuArray, unsafe_free!, adapt, Mem, CuPtr
using BenchmarkTools
###############################################################################
mutable struct SimpleCuIterator{B}
batches::B
previous::Any
SimpleCuIterator(batches) = new{typeof(batches)}(batches)

Beacon Biosignals | Lead Cloud Ops Engineer

(Boston, MA | Onsite Available, Remote Friendly | Full Time)

We're seeking an individual to lead the development/operations of our AWS infrastructure, and along the way teach us all how to deliver more robust software.

About Us:

Despite its significant potential for improving patient outcomes, brain monitoring is still not easily accessible or interpretable in clinical settings. We're going to fix that, and we'd like you to help.

Beacon Biosignals | Senior Machine Learning Engineer

(Boston, MA | Onsite Available, Remote Friendly | Full Time)

Our early-stage startup is seeking an individual to lead machine learning research/development efforts at Beacon, and along the way teach us all all how to deliver robust models to improve human health.

About Us:

Despite its significant potential for improving patient outcomes, brain monitoring is still not easily accessible or interpretable in clinical settings. We're going to fix that, and we'd like you to help.