Skip to content

Instantly share code, notes, and snippets.

@nlgranger
nlgranger / generic_linkcode_resolve_for_sphinx.py
Last active May 18, 2024 06:27
A generic implementation of linkcode_resolve for the 'sphinx.ext.viewcode' extension of sphinx
# the sphinx extension 'sphinx.ext.viewcode' links documentation to an online
# code repository but requires to bind the code to the url through a user
# specific `linkcode_resolve` function. This implementation should be fairly
# generic and easily adaptable.
#
# License: Public Domain, CC0 1.0 Universal (CC0 1.0)
import sys
import os
import subprocess
@nlgranger
nlgranger / wideresnet.py
Last active February 6, 2018 11:30
Wide ResNet in Lasagne/Theano
from lasagne.layers import BatchNormLayer, NonlinearityLayer, Conv2DLayer, \
DropoutLayer, ElemwiseSumLayer, GlobalPoolLayer
from lasagne.nonlinearities import rectify
from lasagne.init import HeNormal
def wide_resnet(l_in, d, k, dropout=0.):
"""Build a Wide-Resnet WRN-d-k [Zagoruyko2016]_
Parameters
@nlgranger
nlgranger / command_and_output
Last active January 24, 2018 09:57
standalone CTC in Theano
$ nosetests .
Using cuDNN version 7005 on context None
Preallocating 9494/11170 Mb (0.850000) on cuda1
Mapped name None to device cuda1: GeForce GTX 1080 Ti (0000:03:00.0)
EEE
======================================================================
ERROR: test_forward_backward (test_ctc.TestCTC)
--------------------------------------------------
FROM nvidia/cuda:8.0-cudnn5-devel
WORKDIR /root
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y --no-install-recommends openssl ca-certificates \
git-core cmake curl wget unzip gfortran libreadline-dev ncurses-dev \
libgoogle-glog-dev libboost-dev libboost-thread-dev libopenblas-dev
@nlgranger
nlgranger / Dockerfile
Created February 9, 2017 14:49
Minimal Nvidia docker with latest torch version
FROM nvidia/cuda:8.0-cudnn5-devel
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y --no-install-recommends openssl ca-certificates \
git-core cmake curl wget unzip gfortran libreadline-dev ncurses-dev \
libgoogle-glog-dev libboost-dev libboost-thread-dev libopenblas-dev
# Core Torch packages
RUN git clone https://github.com/torch/luajit-rocks.git