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
cd /Users/yaroslavvb/tfimmediate_hood.cpu_three | |
git clone https://github.com/yaroslavvb/tensorflow.git | |
export clonedir=/Users/yaroslavvb/tfimmediate_hood.cpu_three/tensorflow | |
export dev_branch=hood-devel | |
export pr_branch=hood | |
git fetch --all | |
git checkout $dev_branch | |
git pull |
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 | |
from tensorflow.core.framework import op_def_pb2 | |
from google.protobuf import text_format | |
def get_op_types(op): | |
for attr in op.attr: | |
if attr.type != 'type': | |
continue | |
return list(attr.allowed_values.list.type) | |
return [] |
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
# try running cpu intensive test on two devices | |
import tensorflow as tf | |
import time | |
def matmul_op(): | |
"""Multiply two matrices together""" | |
n = 2000 | |
a = tf.ones((n, n), dtype=tf.float32) |
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
"""Benchmark tensorflow distributed by adding vector of ones on worker2 | |
to variable on worker1 as fast as possible. | |
On 2014 macbook, TensorFlow 0.10 this shows | |
Local rate: 2175.28 MB per second | |
Distributed rate: 107.13 MB per second | |
""" |
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
a = tf.constant([[1,2],[3,4]]) | |
row_to_add = tf.constant([1, 1]) | |
original_row = a[0] | |
updated_row = original_row + row_to_add | |
unchanged_indices = tf.range(tf.size(a)) | |
changed_indices = tf.range(a.get_shape()[0]) | |
a_flat = tf.reshape(a, [-1]) | |
updated_a_flat = tf.dynamic_stitch([unchanged_indices, changed_indices], [a_flat, updated_row]) | |
updated_a = tf.reshape(updated_a_flat, a.get_shape()) | |
print sess.run(updated_a) |
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
a = tf.constant([[1,2],[3,4]]) | |
row_to_add = tf.constant([[1, 1]]) | |
updated_row = a[0]+row_to_add | |
updated_a = tf.concat(0, [updated_row, a[1:]]) | |
sess.run(updated_a) |
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
# testing variable order init | |
import tensorflow as tf | |
def initialize_all_variables(sess=None): | |
"""Initializes all uninitialized variables in correct order. Initializers | |
are only run for uninitialized variables, so it's safe to run this multiple | |
times. | |
Args: |
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 | |
from tensorflow.python.client import timeline | |
n = 1024 | |
with tf.device("cpu:0"): | |
a1 = tf.ones((n, n)) | |
a2 = tf.ones((n, n)) | |
with tf.device("cpu:1"): | |
a3 = tf.matmul(a1, a2) | |
with tf.device("cpu:2"): |
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 | |
fn = "/tmp/efs/yaroslav/g/train_1/events.out.tfevents.1476852642.g-w-1-vblgv" | |
for summary in tf.train.summary_iterator(): | |
print(summary) |
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
"""Example of launching distributed service and then bringint it down.""" | |
import subprocess | |
import tensorflow as tf | |
import time | |
import sys | |
flags = tf.flags | |
flags.DEFINE_string("port1", "12222", "port of worker1") | |
flags.DEFINE_string("port2", "12223", "port of worker2") |
OlderNewer