Skip to content

Instantly share code, notes, and snippets.

View wweic's full-sized avatar
😀
Hacking

Wei Chen wweic

😀
Hacking
View GitHub Profile
@wweic
wweic / tensor_array.md
Last active March 30, 2019 04:44
TensorArray in Relay

Relay Tensor/TensorArray definition

// Support tensors up to rank 6, i'm using int to represent a dimention just to 
// make the code compile in OCaml while I experiment
type dynamic_tensor =
    Tensor0 of int
  | Tensor1 of int * int
  | Tensor2 of int * int * int
  | Tensor3 of int * int * int * int
 | Tensor4 of int * int * int * int * int
@wweic
wweic / relay.py
Created March 21, 2019 01:08
Relay CLI and REPL
import argparse
import tvm
from tvm import relay
from tvm.relay import testing, create_executor
SEM_VER='v0.0.1'
def parse_args():
parser = argparse.ArgumentParser(description='Run relay program')
$ python foo.py &
[1] 21377
$ gdb -p 21377
GNU gdb (GDB) Fedora 7.7.1-17.fc20
[... gdb loading messages ...]
0x00007f9a09af46e3 in __select_nocancel () at ../sysdeps/unix/syscall-template.S:81
81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
(gdb) py-bt
#4 Frame 0x22d9c70, for file foo.py, line 12, in forever ()
sleep(1)
@wweic
wweic / change_of_address.md
Last active November 1, 2017 15:03
Change of address
  • USPS change of address
  • Bank, Credit card
  • Paypal
  • Apple ID
  • Auto insurance
  • Medical insurance
  • Employer information
  • Mobile account information
  • PG&E
  • Comcast

Find next commit

git log --reverse --ancestry-path 05e871d^..master
@wweic
wweic / 20130416-todo.md
Created November 28, 2016 02:07 — forked from mrflip/20130416-todo.md
Elasticsearch Tuning Plan

Next Steps

  • Measure time spend on index, flush, refresh, merge, query, etc. (TD - done)
  • Take hot threads snapshots under read+write, read-only, write-only (TD - done)
  • Adjust refresh time to 10s (from 1s) and see how load changes (TD)
  • Measure time of a rolling restart doing disable_flush and disable_recovery (TD)
  • Specify routing on query -- make it choose same node for each shard each time (MD)
  • GC new generation size (TD)
  • Warmers
  • measure before/after of client query time with and without warmers (MD)
#include <thread>
int const NUM_THREADS = 5;
uint32_t counter[NUM_THREADS];
void driver(int threadId) {
for (int i = 0; i < 100000000; ++i) {
counter[threadId * 16]++;
}
type token = Bool of bool
| Number of int
| Identifier of string
| SemiColon
| LeftBracket
| RightBracket
| LeftParen
| RightParen
| KeywordIf
| KeywordThen
class Solution {
public:
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
sort(nums1.begin(), nums1.end());
sort(nums2.begin(), nums2.end());
int i1 = 0, i2 = 0;
vector<int> result;
while (i1 < nums1.size() && i2 < nums2.size()) {
if (nums1[i1] == nums2[i2]) {