Skip to content

Instantly share code, notes, and snippets.

View sanjoy's full-sized avatar

Sanjoy Das sanjoy

View GitHub Profile
import tensorflow.compat.v1 as tf
import tensorflow.xla as xla
import numpy as np
tf.disable_eager_execution()
LABELS = 10
HIDDEN_SIZE = 256
BATCH_SIZE = 64
FEAT_DIM = 784
#!/bin/bash
if [[ "$#" -ne 1 ]]; then
echo "usage: git trash < branch name >"
exit 1
fi
git update-ref refs/trash/${1} ${1}
git branch -D ${1}
template<typename T>
bool is_even_0(T v) {
// v is odd iff it has an multiplicative inverse modulo 2^bitwidth(T)
for (T i = 1; i != 0; i++)
if (T(v * i) == T(1))
return false; // odd
return true;
}
#!/bin/bash
git svn dcommit --dry-run | grep 'diff-tree' | awk '{print $3}' | while read hash; do
git log --stat -n 1 ${hash}
echo " -- "
echo ""
done | less -FRXS
#ifndef __PRIME_HPP
#define __PRIME_HPP
#include <algorithm>
#include <cassert>
#include <climits>
#include <iostream>
#include <vector>
class PrimeCheck {
#include <algorithm>
#include <climits>
#include <iostream>
#include <vector>
using namespace std;
namespace {
class PrimeCheck {