Skip to content

Instantly share code, notes, and snippets.

@yzh119
yzh119 / cite-formatter.py
Created January 26, 2023 18:30
Automatically add `~` before each appearance of `\cite`
import os
import sys
import glob
import logging
logging.basicConfig(level=logging.INFO)
def fix_cite_format(line_number: int, line: str):
out = ""
@yzh119
yzh119 / retro-sparsetir-artifact.md
Last active February 21, 2023 00:20
Retrospective on SparseTIR artifact

Retrospective on SparseTIR artifact

Once SparseTIR was accepted to ASPLOS 2023, we began constructing the sparsetir-artifact repository for artifact evaluation. Though we already have lots of benchmarking scripts, we found it still not a trivial job to put them together and evaluate in a unified manner. While preparing our artifact, we also found some problems with our profiler and bugs in existing implementations. We carefully addressed these issues and standardized the settings for all baselines. We are writing this post to document the challenges we faced and the lessons we learned from creating the artifact. We aim to provide insight that will benefit researchers and engineers working in related fields.

Notes on performance difference

If you previously read our manuscript on ArXiv, you may have noticed that there are some discrepancies in the reported performance between SparseTIRv3 and our [camera-ready ver

@yzh119
yzh119 / st-gumbel.py
Created January 12, 2018 12:25
ST-Gumbel-Softmax-Pytorch
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def sample_gumbel(shape, eps=1e-20):
U = torch.rand(shape).cuda()
return -Variable(torch.log(-torch.log(U + eps) + eps))
@yzh119
yzh119 / quine.c
Created April 2, 2021 05:47
My solution to quine program in C
#include <stdio.h>
char str[] = "#include <stdio.h>%cchar str[] = %c%s%c;%cint main() {%c printf(str, 10, 34, str, 34, 10, 10, 10);%c}";
int main() {
printf(str, 10, 34, str, 34, 10, 10, 10);
}