Skip to content

Instantly share code, notes, and snippets.

View gongzhitaao's full-sized avatar
🐢
(๑•̀ㅂ•́)و✧

Zhitao Gong gongzhitaao

🐢
(๑•̀ㅂ•́)و✧
  • DeepMind
  • Montreal, CA
  • 19:35 (UTC -04:00)
View GitHub Profile
@gongzhitaao
gongzhitaao / COMP2710-2019.md
Last active June 4, 2019 18:56
COMP 2710 2019 Spring Grading Script

This gist contains all the grading script for COMP2710 2019 Spring session.

@gongzhitaao
gongzhitaao / pytorch-print.py
Created September 16, 2018 18:52
Get output from intermediatelayers
from functools import partial
def foo(self, inp, out, name=''):
log.debug('layer name {}'.format(name))
log.debug('input size {}'.format(inp[0].size()))
log.debug('output size {}'.format(out[0].size()))
bar = partial(foo, name='Conv2d_1a_3x3')
@gongzhitaao
gongzhitaao / py-logger-template.py
Last active October 12, 2022 11:38
Python logging template
import logging
import logging.config
from datetime import datetime
import os
import sys
LOGFILE = '/tmp/{0}.{1}.log'.format(
os.path.basename(__file__),
datetime.now().strftime('%Y%m%dT%H%M%S'))
@gongzhitaao
gongzhitaao / 0tmp.png
Last active September 16, 2018 23:45
Plot top5 probabilities and labels
0tmp.png
@gongzhitaao
gongzhitaao / COMP2710 README.md
Last active April 27, 2018 20:35
Comments for COMP2710 Spring 2018

This a collection of tips and feedbacks for COMP2710 Software Construction Spring 2018.

  1. Grading script for hw1 gist.
  2. Grading script for hw2 gist.
@gongzhitaao
gongzhitaao / Tick.md
Last active December 22, 2017 22:53
Simple context timer in Python3

Simple decorator timer in Python3.

@tick
def foo():
  for i in range(100):
    pass
@gongzhitaao
gongzhitaao / PDFEditingScript.md
Created March 10, 2017 15:15
Useful PDF editing scripts.

This repo collects convenient scripts.

  1. graypdf. Convert PDF to grayscale.
  2. mergepdf. Merge a sequence of PDF files.
@gongzhitaao
gongzhitaao / COMP2710_GradingScript.md
Last active February 8, 2018 22:45
Grading script for COMP2710

This gist contains my homework grading scripts for Auburn COMP2017 in Spring semseter. grade1.py for homework 1, grade2.py for homework 2 and so on. Shoot me an email if you have questions.

@gongzhitaao
gongzhitaao / KerasBug.md
Last active March 27, 2017 18:47
A keras bug reproduce.

The script shows a wierd bug using keras with tensorflow.

When you use the tf.while_loop function

  1. if you include the Dropout layer or set the total number of epochs to greater than 10, then the program hangs and never returns.
  2. Otherwise, it works fine.

I've updated to the latest version of keras and tensorflow. This bug persists. It seems to be a bug with keras. Since I could not reproduce this with pure tensorflow code.

@gongzhitaao
gongzhitaao / !RemoteSync.md
Last active March 7, 2017 14:18
Sync local folder with remote folder.

This Makefile sync current local working folder with the remote folder.

When working on a server, I always want to edit files locally and then push them to servers to run. However I do not want to track what files I just changed and push them one by one using SFTP. rsync solves this issue elegantly.

Concretely, when I'm finishing editing files locally, I just type