Skip to content

Instantly share code, notes, and snippets.

@05jd
05jd / run_template.sub
Last active December 2, 2019 01:04
Slurm batch submission template
#!/bin/bash
# Schedules and Resources
#SBATCH --nodes=1
##SBATCH --ntasks-per-node=1
##SBATCH --cpus-per-task=2
#SBATCH --mem=16GB
#SBATCH --time=24:00:00 # Default: one-hour 01:00:00
# GPU resources to request
@05jd
05jd / bash_aliases
Last active December 1, 2019 22:54
Bash aliases for NYU clusters
# Predefined Locations
VENV_HOME=$HOME/venv
ETC_HOME=$HOME/etc
## Virtual environments
venv() {
source $VENV_HOME/$1/bin/activate
@05jd
05jd / flops.py
Created August 26, 2018 15:10
Counting FLOPs of a Keras model
"""Code Snippet for counting FLOPs of a model.
Not final version, it will be updated to improve the usability.
"""
import os.path
import tempfile
import tensorflow as tf
@05jd
05jd / ctxmgr.py
Last active June 10, 2018 08:27
Simple session context manager of tensorflow session
import tensorflow as tf
class SessionContextManager(object):
"""Session context management of tensorflow session and graph.
This class handles a default session and a default graph at once
for both Tensorflow and Keras.
"""