Skip to content

Instantly share code, notes, and snippets.

Elliot Saba staticfloat

Block or report user

Report or block staticfloat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View jlj
#!/bin/bash
# Helper to jump to julia package source
function jlj()
{
if [[ $# != 1 ]]; then
echo "Usage: jlj <package name>" >&2
return
fi
View resign.sh
#!/bin/bash
set -e
set -x
if [[ -z "$MACOS_CODESIGN_IDENTITY" ]]; then
echo "ERROR: Must export MACOS_CODESIGN_IDENTITY" > &2
exit 1
fi
# detach anything that's old
View build_FFTW.v3.3.9.jl
using BinaryProvider # requires BinaryProvider 0.3.0 or later
# Parse some basic command-line arguments
const verbose = "--verbose" in ARGS
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")))
products = [
LibraryProduct(prefix, ["libfftw3"], :libfftw3),
LibraryProduct(prefix, ["libfftw3f"], :libfftw3f),
]
View build_FFTW.v3.3.9.jl
using BinaryProvider # requires BinaryProvider 0.3.0 or later
# Parse some basic command-line arguments
const verbose = "--verbose" in ARGS
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")))
products = [
LibraryProduct(["libfftw3"], :libfftw3),
LibraryProduct(["libfftw3f"], :libfftw3f),
]
View strace log example
$ strace -e trace=stat,lstat,open,close julia
open("/home/sabae/local/dist/julia-release-1.2/bin/../lib/tls/x86_64/libjulia.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/sabae/local/dist/julia-release-1.2/bin/../lib/tls/x86_64", 0x7ffc823f5290) = -1 ENOENT (No such file or directory)
open("/home/sabae/local/dist/julia-release-1.2/bin/../lib/tls/libjulia.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/sabae/local/dist/julia-release-1.2/bin/../lib/tls", 0x7ffc823f5290) = -1 ENOENT (No such file or directory)
open("/home/sabae/local/dist/julia-release-1.2/bin/../lib/x86_64/libjulia.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/sabae/local/dist/julia-release-1.2/bin/../lib/x86_64", 0x7ffc823f5290) = -1 ENOENT (No such file or directory)
open("/home/sabae/local/dist/julia-release-1.2/bin/../lib/libjulia.so.1", O_RDONLY|O_CLOEXEC) = 3
close(3) = 0
open("/home/sabae/local/dist/julia-release
View zygote_fakesin.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@staticfloat
staticfloat / softmax.jl
Created May 29, 2019
Threading speed test
View softmax.jl
using Base.Threads
function softmax!(out::AbstractVecOrMat{T}, xs::AbstractVecOrMat{T}) where {T}
# Remove `@threads` for non-threading timing
@inbounds @threads for j = 1:size(xs, 2)
# First, store column-wise maximum in the last element of `out`
out[end, j] = xs[end, j]
@inbounds for i = 1:(size(xs, 1) - 1)
out[end, j] = max(out[end, j], xs[i, j])
end
View github_remote
#!/usr/bin/env bash
## Helper script to turn an `https://` clone of a github repository into something that you
## can push from. Supports both invocation as `github_remote`, as well as with an optional
## username, to add a particular user's fork as a remote, e.g. `github_remote avik-pal`.
ORIGIN_URL=$(git remote get-url origin 2>/dev/null)
if [[ -z "${ORIGIN_URL}" ]]; then
echo "ERROR: No origin remote?!"
exit 1
View cached_conv.jl
struct CachedConv
conv::Conv
cache::Ref{Tuple}
end
CachedConv(c::Conv) = CachedConv(c, ())
Flux.@treelike CachedConv
function (m::CachedConv)(x::AbstractArray)
# Has the user changed batch size on us? If so, clear our cache and re-up!
if !isempty(m.cache[]) && size(m.cache[][2], 4) != size(x, 4)
@staticfloat
staticfloat / zygote_batch_norm.jl
Last active Apr 11, 2019
Zygote BatchNorm implementation
View zygote_batch_norm.jl
using Zygote, Statistics, Flux
# We modify (the implementation of) batchnorm to be more ammenable to CPUs pretending to be TPUs.
struct ZygoteBatchNorm{F,V,W}
λ::F # activation function
β::V # bias
γ::V # scale
μ::W # moving mean
σ::W # moving std
ϵ::Float32
You can’t perform that action at this time.