View notebook.jl
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
### A Pluto.jl notebook ### | |
# v0.16.1 | |
using Markdown | |
using InteractiveUtils | |
# ╔═╡ d00d6ce7-6cb2-4a8e-a119-aafe2d372a77 | |
function stencil(kernel_f!, N) | |
A = reshape(BandedMatrix(Zeros(N^2, N^2), (N+1, N+1)), N, N, N, N) | |
_A = PaddedArray(A, 0) |
View gist:fb6eff0d212f8514ecec186a69712a82
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
(rows, cols) = (2, 2) | |
BenchmarkTools.Trial: | |
memory estimate: 0 bytes | |
allocs estimate: 0 | |
-------------- | |
minimum time: 16.041 ns (0.00% GC) | |
median time: 16.074 ns (0.00% GC) | |
mean time: 16.189 ns (0.00% GC) | |
maximum time: 104.773 ns (0.00% GC) | |
-------------- |
View abs_to_pow.jl
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 ChainRulesCore | |
import ChainRulesCore: wirtinger_primal, wirtinger_conjugate | |
using ChainRulesCore: AbstractDifferential | |
using FiniteDifferences | |
using Test | |
abs_to_pow(x, p) = abs(x)^p | |
@scalar_rule(abs_to_pow(x::Real, p), | |
(p == 0 ? Zero() : p * abs_to_pow(x, p-1) * sign(x), Ω * log(abs(x)))) | |
@scalar_rule( |
View toy_chainrules_cassette_ad.jl
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 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) |
View designer.html
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
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<link rel="import" href="../core-toolbar/core-toolbar.html"> | |
<link rel="import" href="../core-header-panel/core-header-panel.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; |
View designer.html
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
<link rel="import" href="../paper-ripple/paper-ripple.html"> | |
<polymer-element name="name-card" attributes="first, name, color, href"> | |
<template> | |
<style> | |
#core_card { | |
position: absolute; | |
border-top-left-radius: 2px; | |
border-top-right-radius: 2px; |