- Time of benchmarks:
- Target: 22 May 2019 - 20:28
- Baseline: 22 May 2019 - 20:57
- Package commits:
- Target: fa170b
- Baseline: 852664
- Julia commits:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Zygote: @adjoint, _pullback, Context, cache | |
using AutoPreallocation | |
using Cassette | |
export expect, ∇expect, exact_expect, ∇exact_expect | |
using AutoPreallocation: RecordingCtx, ReplayCtx | |
# https://github.com/oxinabox/AutoPreallocation.jl/pull/9 | |
@inline Cassette.overdub(ctx::RecordingCtx, ::typeof(Base.haskey), collection, key) = haskey(collection, key) | |
@inline Cassette.overdub(ctx::ReplayCtx, ::typeof(Base.haskey), collection, key) = haskey(collection, key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using LinearAlgebra | |
using LinearAlgebra: promote_op, matprod | |
# multiply 2x2 matrices | |
function matmul2x2(tA, tB, A::AbstractArray{T, 3}, B::AbstractArray{S, 3}) where {T,S} | |
matmul2x2!(similar(B, promote_op(matprod, T, S), 2, 2, size(A, 3)), tA, tB, A, B) | |
end | |
function matmul2x2!(C::AbstractArray{T1, 3}, tA, tB, A::AbstractArray{T2, 3}, B::AbstractArray{T3, 3}) where {T1,T2,T3} | |
if !(size(A) == size(B) == size(C) == (2,2, size(A, 3))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using TNFilters | |
using Flux | |
using Zygote | |
using BenchmarkTools | |
using TNFilters: bmm, bmm!, batched_tr | |
using Flux: params | |
using Zygote: AContext, Context, _pullback, cache, accum_param | |
# I have not found why yet, the manual generated result roughly gives the same performance as Tracker (Tracker is about 35μs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HoistMem | |
export hoist_alloc, Buffer | |
using Cassette, LinearAlgebra | |
using Cassette: @context, overdub | |
@context BuffCtx | |
mutable struct Buffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Test | |
using IRTools, LinearAlgebra, InteractiveUtils | |
using IRTools: IR, Branch, BasicBlock, return!, blocks, block, | |
Pipe, var, arguments, xcall, finish, argnames!, | |
slots!, pis!, inlineable! | |
# NOTE: do not restrict ElmentType, since it can be either Number/Array/Any | |
struct VecArray{T, D, ElmentType, N, S <: AbstractArray{T, N}} <: AbstractVector{ElmentType} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Flux, Tracker, DelimitedFiles | |
using LinearAlgebra, Random | |
using Flux: onehotbatch | |
using Flux.Optimise | |
using Flux.Optimise: update! | |
using Tracker: TrackedReal, data | |
using Base.Iterators: partition | |
using BitBasis | |
function generate_sample(m, L, batch_size=64) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julia> @code_llvm diff(a) | |
; Function diff | |
; Location: REPL[7]:1 | |
define void @julia_diff_35329([19 x i64]* noalias nocapture sret, [20 x i64] addrspace(11)* nocapture nonnull readonly dereferenceable(160)) { | |
top: | |
; Function getindex; { | |
; Location: tuple.jl:24 | |
%2 = getelementptr [20 x i64], [20 x i64] addrspace(11)* %1, i64 0, i64 1 | |
%3 = getelementptr [20 x i64], [20 x i64] addrspace(11)* %1, i64 0, i64 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using YAAD | |
using YAAD.TestUtils | |
x = Variable(rand(10, 10)) | |
z = Variable(rand(10)) | |
y = cos.(x) * sin.(z) | |
TestUtils.get_analytical_jacobian((x, z), y) |