Skip to content

Instantly share code, notes, and snippets.

@lopuhin
lopuhin / resnet_mkldnn.py
Created June 6, 2019 18:27
Faster ResNet CPU inference with MKLDNN + PyTorch 1.1
$ pip install torch==1.1.0 torchvision==0.3.0
$ OMP_NUM_THREADS=1 ipython
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
In [1]: import torch
...: from torchvision.models import resnet50
In [2]: def forward(m, x):
...: """ resnet without average pooling """
...: x = m.conv1(x)
@malloxpb
malloxpb / final-gsoc-report.md
Last active December 17, 2018 08:53
Final Report for GSoC 2018
import numpy as np
import marisa_trie
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.externals import six
class MarisaCountVectorizer(CountVectorizer):
# ``CountVectorizer.fit`` method calls ``fit_transform`` so
# ``fit`` is not provided
def fit_transform(self, raw_documents, y=None):