Skip to content

Instantly share code, notes, and snippets.

View gist:fb6eff0d212f8514ecec186a69712a82
(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
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
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
<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
<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;