Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Konpat phizaz

🏠
Working from home
Block or report user

Report or block phizaz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@phizaz
phizaz / inspect-trained-model.ipynb
Last active Feb 14, 2019
Pytorch: Inspect Activations Layer-by-layer in Trained Model
View inspect-trained-model.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phizaz
phizaz / tensorflow_summary_v2_eager.py
Created Jul 8, 2018
Tensorflow summary v2 eager mode
View tensorflow_summary_v2_eager.py
import tensorflow as tf
import numpy as np
tf.enable_eager_execution()
save_path = 'logs/test10'
graph = tf.Graph()
with graph.as_default():
global_step = tf.train.create_global_step()
writer = tf.contrib.summary.create_file_writer(save_path)
View tensorflow_summary_v2_graph.py
import tensorflow as tf
import numpy as np
save_path = 'summary_path'
graph = tf.Graph()
with graph.as_default():
global_step = tf.train.create_global_step()
writer = tf.contrib.summary.create_file_writer(save_path)
with writer.as_default():
tf.contrib.summary.always_record_summaries()
View tensorflow_summary_v2_graph.py
import tensorflow.contrib.summary as summary
global_step = tf.train.get_or_create_global_step()
optimizer = tf.train.AdamOptimizer(lr).minimize(..., global_step=global_step)
writer = summary.create_file_writer('log')
writer.set_as_default()
summary.always_record_summaries()
with summary.record_summaries_every_n_global_steps(1):
@phizaz
phizaz / live-output.py
Created Jan 20, 2018
python subprocess's Popen live-output with "select"
View live-output.py
from select import select
import os
import time
import subprocess
from contextlib import contextmanager
@contextmanager
def pipe():
r, w = os.pipe()
@phizaz
phizaz / keras_2dconv_layer.py
Last active Dec 6, 2017
Keras 2D Conv Layer without Conv2D
View keras_2dconv_layer.py
class MyConv(Layer):
'''
Implemeting a Conv2D with strides=1, and 'valid' padding
'''
def __init__(self, filters, kernel, **kwargs):
self.filters = filters
self.k_h, self.k_w = kernel
super(MyConv, self).__init__(**kwargs)
View keras_empty_layer.py
class MyLayer(Layer):
def __init__(self, **kwargs):
...
super(MyConv, self).__init__(**kwargs)
def build(self, input_shape):
...
super(MyConv, self).build(input_shape)
def call(self, x):
@phizaz
phizaz / Untitled.ipynb
Created Oct 23, 2017
Stackoverflow: Connecting two graphs
View Untitled.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phizaz
phizaz / style.html
Created Oct 23, 2017
Ipython notebook html export css styles
View style.html
<style type="text/css">
/*!
*
* Twitter Bootstrap
*
*/
/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
@phizaz
phizaz / .bash_profile
Created Sep 28, 2017
Try to create a bash script for recursively building sources from arch linux repo for MSYS2
View .bash_profile
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any warranty.
# You should have received a copy of the CC0 Public Domain Dedication along
# with this software.
# If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
# ~/.bash_profile: executed by bash(1) for login shells.
# The copy in your home directory (~/.bash_profile) is yours, please
You can’t perform that action at this time.