Skip to content

Instantly share code, notes, and snippets.

View ikhlestov's full-sized avatar
🐍
Coding

Illarion ikhlestov

🐍
Coding
View GitHub Profile
@ikhlestov
ikhlestov / 01_simple_example.py
Last active September 9, 2020 08:05
01_Profiling Tensorflow with timeline
import tensorflow as tf
from tensorflow.python.client import timeline
a = tf.random_normal([2000, 5000])
b = tf.random_normal([5000, 1000])
res = tf.matmul(a, b)
with tf.Session() as sess:
# add additional options to trace the session execution
options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
@ikhlestov
ikhlestov / multithreaded_data_provider.py
Created March 16, 2017 16:55
Tensorflow multithreading data provider
import tensorflow as tf
class MultithreadedTensorProvider():
""" A class designed to provide tensors input in a
separate threads. """
def __init__(self, capacity, sess, dtypes, shuffle_queue=False,
number_of_threads=1):
def composite_function(self, _input, out_features, kernel_size=3):
"""Function from paper H_l that performs:
- batch normalization
- ReLU nonlinearity
- convolution with required kernel
- dropout, if required
"""
with tf.variable_scope("composite_function"):
# BN
output = self.batch_norm(_input)
import json
import tensorflow as tf
from tensorflow.python.client import timeline
x = tf.random_normal([1000, 1000])
y = tf.random_normal([1000, 1000])
res = tf.matmul(x, y)
# Run the graph with full trace option
import hashlib
import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument('--md5', type=str, required=True)
args = parser.parse_args()
script_to_run = 'some.py'
@ikhlestov
ikhlestov / tmux-cheatsheet.markdown
Created November 1, 2016 13:08 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
def mi_linear(arg1, arg2, output_size, global_bias_start=0.0, scope=None):
"""Multiplicated Integrated Linear map:
See http://arxiv.org/pdf/1606.06630v1.pdf
A * (W[0] * arg1) * (W[1] * arg2) + (W[0] * arg1 * bias1) + (W[1] * arg2 * bias2) + global_bias.
Args:
arg1: batch x n, Tensor.
arg2: batch x n, Tensor.
output_size: int, second dimension of W[i].
global_bias_start: starting value to initialize the global bias; 0 by default.
scope: VariableScope for the created subgraph; defaults to "MILinear".