Skip to content

Instantly share code, notes, and snippets.

View IvanYashchuk's full-sized avatar

Ivan Yashchuk IvanYashchuk

View GitHub Profile
@ttesmer
ttesmer / AD.hs
Last active October 29, 2024 15:35
Automatic Differentiation in 38 lines of Haskell using Operator Overloading and Dual Numbers. Inspired by conal.net/papers/beautiful-differentiation
{-# LANGUAGE TypeSynonymInstances #-}
data Dual d = D Float d deriving Show
type Float' = Float
diff :: (Dual Float' -> Dual Float') -> Float -> Float'
diff f x = y'
where D y y' = f (D x 1)
class VectorSpace v where
zero :: v
@xdralex
xdralex / checklist.md
Created April 19, 2021 13:39
ML/DL/CS Checklist

Deep Learning

concepts

  • forward and backward propagation
  • vanishing gradient
  • image convolution operation
  • feature map, filter/kernel
  • receptive field
  • embedding
  • translation invariance
@niklasschmitz
niklasschmitz / jaxpr_graph.py
Last active June 24, 2024 17:53 — forked from mattjj/grad_graph.py
visualizing jaxprs
import jax
from jax import core
from graphviz import Digraph
import itertools
styles = {
'const': dict(style='filled', color='goldenrod1'),
'invar': dict(color='mediumspringgreen', style='filled'),
'outvar': dict(style='filled,dashed', fillcolor='indianred1', color='black'),
using ForwardDiff
goo((x, y, z),) = [x^2*z, x*y*z, abs(z)-y]
foo((x, y, z),) = [x^2*z, x*y*z, abs(z)-y]
function foo(u::Vector{ForwardDiff.Dual{T,V,P}}) where {T,V,P}
# unpack: AoS -> SoA
vs = ForwardDiff.value.(u)
# you can play with the dimension here, sometimes it makes sense to transpose
ps = mapreduce(ForwardDiff.partials, hcat, u)
# get f(vs)
val = foo(vs)
@mdo
mdo / 00-intro.md
Last active November 15, 2024 14:13
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top