Skip to content

Instantly share code, notes, and snippets.

View Roger-luo's full-sized avatar
🍭
casting spells

Xiu-zhe (Roger) Luo Roger-luo

🍭
casting spells
View GitHub Profile
@Roger-luo
Roger-luo / rename.py
Last active January 10, 2018 09:26
change PyTorch generic type name to whatever you want
"""Convert generic type name (real) in PyTorch project
to whatever you want.
Author: Roger-luo
"""
import os
import re
import sys
@Roger-luo
Roger-luo / Register.jl
Created May 13, 2018 12:14
A naive quanutm register
#################
# Utils
#################
"""
log2i(x)
logrithm for integer pow of 2
"""
function log2i(x::T)::T where T
@Roger-luo
Roger-luo / gist:b2e892ee710c6360a11a1b23d3686c64
Created August 9, 2018 10:16
PyPlot causes segment fault
Process: julia [1067]
Path: /Users/USER/*/julia
Identifier: julia
Version: 0
Code Type: X86-64 (Native)
Parent Process: zsh [762]
Responsible: julia [1067]
User ID: 501
Date/Time: 2018-08-09 18:14:17.173 +0800
@Roger-luo
Roger-luo / Vec256Complex.cpp
Created September 17, 2018 19:33
ATen/cpu/vec256/vec256_complex.h
#pragma once
#include "intrinsics.h"
#include "vec256_base.h"
#if defined(__AVX__) && !defined(_MSC_VER)
#include <sleef.h>
#endif
namespace at {
namespace vec256 {
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)
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

Benchmark Report for YaoArrayRegister

Job Properties

  • Time of benchmarks:
    • Target: 22 May 2019 - 21:52
    • Baseline: 22 May 2019 - 22:20
  • Package commits:
    • Target: fa170b
    • Baseline: 852664
  • Julia commits:

Benchmark Report for YaoArrayRegister

Job Properties

  • Time of benchmarks:
    • Target: 22 May 2019 - 20:28
    • Baseline: 22 May 2019 - 20:57
  • Package commits:
    • Target: fa170b
    • Baseline: 852664
  • Julia commits:
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)
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}