This file contains 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 random | |
from random import choice | |
import tensorflow as tf | |
import numpy as np | |
import pyfastnoisesimd as fns | |
def ch3_fractal_noise(size_chw, seed, | |
color_gain_min=0.5, color_gain_max=1.0, | |
octaves_min=3, octaves_max=6, |
This file contains 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
$ python3 -m fastrnns.bench | |
Namespace(cnns=None, cuda_pointwise_block_count=None, cuda_pointwise_block_size=None, cuda_pointwise_loop_level=None, device='cuda', executor=None, fuser='te', group=['cnns', 'rnns'], hiddenSize=512, inputSize=512, miniBatch=64, nloops=100, numLayers=1, print_json=None, rnns=None, sep=' ', seqLength=100, variable_lstms=False, warmup=10) | |
Benchmarking LSTMs... | |
name avg_fwd std_fwd info_fwd avg_bwd std_bwd info_bwd | |
cudnn 3.384 0.2857 None 3.613 0.06748 None | |
aten 9.766 0.415 None 18.85 0.1766 None | |
jit 10.48 0.1774 None 18.53 0.8058 None | |
jit_premul 8.273 0.07718 None 14.63 0.1991 None | |
jit_premul_bias 8.143 |
This file contains 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
DCT_TABLE_BUFFER = b"\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\x00\x00\x80?\xbe\x14\xfb?0\xdb\xd4?\xda9\x8e?\xc0\xc5\xc7>\xc0\xc5\xc7\xbe\xda9\x8e\xbf0\xdb\xd4\xbf\xbe\x14\xfb\xbf\xbe\x14\xfb?0\xdb\xd4?\xda9\x8e?\xc0\xc5\xc7>\xc0\xc5\xc7\xbe\xda9 |
This file contains 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
directories = [ | |
$(readlink -m ~/Downloads).strip(), | |
$(readlink -m ~/Desktop).strip(), | |
] | |
for d in directories: | |
ls -l @(p) |
This file contains 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 os | |
import tensorflow as tf | |
from tensorflow.contrib import tpu | |
from tensorflow.contrib.cluster_resolver import TPUClusterResolver | |
IMAGE_FILES='gs://MY_OWN_GCS_BUCKET/celeba/files.txt' | |
SIZE=(128,128) | |
BATCH=128 | |
LR=1e-4 |
This file contains 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
global_step = 243830 | |
global_step = 243840 | |
global_step = 243850 | |
2018-11-20 23:42:59.740578: W tensorflow/core/common_runtime/bfc_allocator.cc:219] Allocator (GPU_0_bfc) ran out of memory trying to allocate 301.50MiB. The caller indicates that this is not a failure, bu | |
t may mean that there could be performance gains if more memory were available. | |
2018-11-20 23:42:59.741211: W tensorflow/core/common_runtime/bfc_allocator.cc:219] Allocator (GPU_0_bfc) ran out of memory trying to allocate 301.50MiB. The caller indicates that this is not a failure, bu | |
t may mean that there could be performance gains if more memory were available. | |
2018-11-20 23:42:59.741553: E tensorflow/stream_executor/cuda/cuda_dnn.cc:81] | |
Traceback (most recent call last): | |
File "/home/yusuke/.pyenv/versions/tf1.10/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1278, in _do_call |
This file contains 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 as tf | |
import numpy as np | |
from keras.layers import Conv2D | |
img = tf.constant(np.ones([16,128,128,3]), dtype=tf.float32) | |
conv = Conv2D(32, 3) | |
y = conv(img) | |
graph = tf.get_default_graph() |
This file contains 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
from pathlib import Path | |
import cv2 | |
d = Path('val2017') | |
for f in d.glob('*.jpg'): | |
img = cv2.imread(str(f)) |
This file contains 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 as tf | |
import numpy as np | |
import sys | |
# simple k-means clustering with tensorflow | |
# this is my practice code for tensorflow graph coding | |
# parameters | |
K_SIZE = 5 |
This file contains 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
#!/usr/bin/env python3 | |
# This is full TensolFlow version of Ryan Dahl's Automatic Colorization. | |
# The original is here -> http://tinyclouds.org/colorize/ | |
import sys | |
import tensorflow as tf | |
INPUT_EDGE = 224 | |
INPUT_FILE = 'shark.jpg' | |
OUTPUT_FILE = 'shark-color.jpg' |
NewerOlder