Skip to content

Instantly share code, notes, and snippets.

View pmeier's full-sized avatar

Philip Meier pmeier

View GitHub Profile
@pmeier
pmeier / pytorch_pytest.md
Created April 1, 2021 08:26
A case for pytest in PyTorch

A case for pytest in PyTorch

This is a short post about why I think it would be beneficial for PyTorch to not only use pytest as test runner, but also rely on the other features it provides.

Disclaimer

My experience with the PyTorch test suite is limited as of now. Thus, it might very well be that my view on things is too naive. In that case I'm happy to hear about examples where and adoption of pytest would make a use case significantly harder or outright impossible.

Setup

@pmeier
pmeier / torchvision_datasets_transforms.md
Created February 11, 2021 14:05
Availability of (target_)?transform(s)? arguments in torchvision.datasets

This is an overview over the usage of the availability of the transform, target_transform, and transforms arguments for all datasets from torchvision.datasets.

Dataset transform target_transform transforms
Caltech101 x x
Caltech256 x x
CelebA x x
CIFAR10 x x
CIFAR100 x x
Cityscapes x x x
@pmeier
pmeier / blub.py
Last active November 19, 2020 08:12
test gist
80:
################################################################################
81:
#################################################################################
82:
##################################################################################
83:
###################################################################################
84:
####################################################################################
class Foo:
def bar(self, *baz):
raise NotImplementedError
class SubFoo(Foo):
def bar(self, baz: float) -> str:
pass
@pmeier
pmeier / imagenet_normalization.py
Created March 11, 2020 12:21
Calculation of ImageNet z-score parameters
import argparse
import multiprocessing
from math import ceil
import torch
from torch.utils import data
from torchvision import datasets, transforms
class FiniteRandomSampler(data.Sampler):
def __init__(self, data_source, num_samples):