This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def softmax_reduction(x, y): | |
e_x = np.exp(x - np.max(x)) | |
softmax = e_x / e_x.sum(axis=0) | |
return (softmax * y).sum() | |
def process_one_element( | |
x, y, online_max, online_output, online_denominator): | |
old_online_max = online_max |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __PRIME_HPP | |
#define __PRIME_HPP | |
#include <algorithm> | |
#include <cassert> | |
#include <climits> | |
#include <iostream> | |
#include <vector> | |
class PrimeCheck { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <climits> | |
#include <iostream> | |
#include <vector> | |
using namespace std; | |
namespace { | |
class PrimeCheck { |