Skip to content

Instantly share code, notes, and snippets.

View aesuli's full-sized avatar
🍕

Andrea Esuli aesuli

🍕
View GitHub Profile
@dsc
dsc / gist:3855240
Created October 8, 2012 21:52
Python argparse Cheatsheet
Arg Name or Optional Flags:
positional : str = "foo"
options : str = "-f", "--foo"
Standard:
action : str = [store], append, store_true, store_false, store_const, append_const, version
default : * = [None]
type : callable = [str], argparse.FileType(mode='wb', bufsize=0)
Exotic:
@aesuli
aesuli / csr_to_pytorch_sparse.py
Last active November 3, 2022 03:06
csr matrix to pytorch sparse
import numpy as np
from scipy.sparse import csr_matrix
import torch
__author__ = 'Andrea Esuli'
Acsr = csr_matrix([[1, 2, 0], [0, 0, 3], [4, 0, 5]])
print('Acsr',Acsr)
Acoo = Acsr.tocoo()
@aesuli
aesuli / pip_guide.md
Last active May 19, 2021 14:09
A step-by-step guide on how to create a pip package