Monday, January 5, 2015

Python tricks and tips

If you want to assign incremental ids to a list of words then you can define a defultdict as follows:

wpids = defaultdict(lambda: len(wpids))

No comments:

Post a Comment

Continuously monitor GPU usage

 For nvidia GPUs do the follwing: nvidia-smi -l 1