Skip to content

Instantly share code, notes, and snippets.

View shyoshyo's full-sized avatar
🐟
Fish touching

Kaixiang Lei shyoshyo

🐟
Fish touching
  • ByteDance
  • Shanghai, China
View GitHub Profile
~/p/ncurses-6.1 ➜ ./configure --prefix=$HOME/.local --enable-shared --with-shared --without-debug
#!/bin/sh
sudo fdisk -l
sudo grub-install --root-directory=/mnt /dev/sda
sudo mount /dev/sda2 /mnt
@shyoshyo
shyoshyo / partition.py
Last active October 19, 2018 17:32
整数拆分问题:n 个相同的球,分成若干堆,有几种分法?
#!/usr/bin/env python3
"""
整数拆分问题:n 个相同的球,分成若干堆,有几种分法?
如果要和上界比较,那么绘制下列图像:
* 分拆数及其上界随 n 变化的图像
* 分拆数与其上界之比随 n 变化的图像
"""
import argparse
def spectral_normed_weight(W, u=None, num_iters=1, update_collection=tf.GraphKeys.UPDATE_OPS, name='spectral_norm', eps=1e-12, reuse=False):
with tf.variable_scope(name, reuse=reuse):
W_shape = W.shape.as_list()
n_in = W.shape[:-1].num_elements()
n_out = W.shape[-1].value
W_reshaped = tf.reshape(W, [n_in, n_out])
if u is None: u = tf.get_variable("u", shape=[1, n_out], initializer=tf.truncated_normal_initializer(), trainable=False)
# if u is None: u = tf.Variable(tf.truncated_normal(shape=[1, n_out]), name='u', trainable=False)
CXX = /usr/bin/g++
NVCC = /usr/local/cuda-9.1/bin/nvcc
CUDA_LIB = /usr/local/cuda-9.1/lib64
CUDA_INC = /usr/local/cuda-9.1/include
CUDA_CFLAGS = -I $(CUDA_INC)
CUDA_LFLAGS = -lcudart -L $(CUDA_LIB)
TF_LIB = $(shell python -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())')
TF_INC = $(shell python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')