Skip to content

Instantly share code, notes, and snippets.

View wookayin's full-sized avatar
🎼
Code.

Jongwook Choi wookayin

🎼
Code.
View GitHub Profile
@wookayin
wookayin / keras-save-bug.ipynb
Created March 8, 2019 05:57
TensorFlow Keras model save bug
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wookayin
wookayin / imshow_grid.py
Last active March 19, 2019 20:49
IPython notebook snippet for plotting multiple images in a grid.
# in a courtesy of Caffe's filter visualization example
# http://nbviewer.jupyter.org/github/BVLC/caffe/blob/master/examples/00-classification.ipynb
def imshow_grid(data, height=None, width=None, normalize=False, padsize=1, padval=0):
'''
Take an array of shape (N, H, W) or (N, H, W, C)
and visualize each (H, W) image in a grid style (height x width).
'''
if normalize:
data -= data.min()
-- Make sure TS syntax tree is updated when needed by plugin (with some throttling)
-- even if the `highlight` module is not enabled.
-- See https://github.com/nvim-treesitter/nvim-treesitter/issues/2492
_G.TreesitterParse = function()
local lang = ts_parsers.ft_to_lang(vim.bo.filetype)
local parser = ts_parsers.get_parser(vim.fn.bufnr(), lang)
if parser then
parser:parse()
return true
else

Displaying Configurations in TensorBoard

This is a simple demonstration of displaying training configuration in a TensorBoard, using text summaries.

Screenshot

@wookayin
wookayin / toggle_fstring.lua
Last active November 26, 2023 17:38
Neovim: Toggle f-string for python using treesitter
local ts_utils = require("nvim-treesitter.ts_utils")
local M = {}
-- Credit: https://www.reddit.com/r/neovim/comments/tge2ty/python_toggle_fstring_using_treesitter/
M.toggle_fstring = function()
local winnr = 0
local cursor = vim.api.nvim_win_get_cursor(winnr)
local node = ts_utils.get_node_at_cursor() ---@type TSNode?