Python常用庫文檔總結

Python

https://www.python.org/doc/

《Python編程:從入門到實踐》速查表


matplotlib

https://matplotlib.org/contents.html


numpy

https://numpy.org/devdocs/


pytorch

英文文檔:https://pytorch.org/docs/stable/index.html

中文文檔:https://pytorch-cn.readthedocs.io/zh/latest/package_references/torch/


scikit-image

https://scikit-image.org/docs/stable/


pickle

https://docs.python.org/3.5/library/pickle.html


easydict(字典解析庫)

https://pypi.org/project/easydict/1.2/


os(操作系統接口模塊)

https://docs.python.org/3/library/os.html?highlight=os#module-os


sys

https://docs.python.org/3/library/sys.html?highlight=sys#module-sys


argparse(解析命令行)

https://docs.python.org/3/library/argparse.html?highlight=argparse#module-argparse


fire(命令行生成工具)

https://github.com/google/python-fire/blob/master/docs/guide.md


logging(日誌)

https://docs.python.org/3.6/howto/logging.html


tensorboardX(網絡可視化)

https://tensorboardx.readthedocs.io/en/latest/tutorial.html


tqdm(進度條工具)

https://pypi.org/project/tqdm/


glob(文件搜索庫)

https://docs.python.org/3/library/glob.html?highlight=glob#module-glob


re(正則化)

https://docs.python.org/3/library/re.html


io

https://docs.python.org/3/library/io.html?highlight=io#module-io


time

https://docs.python.org/3/library/time.html?highlight=time#module-time


datitime

https://docs.python.org/3/library/datetime.html?highlight=datetime#module-datetime


numba(Python加速庫)

http://numba.pydata.org/

import numpy as np
import numba
from numba import jit

print(numba.__version__)

@jit(nopython=True)
'''
The nopython=True option requires that the function be fully compiled  

'''
def go_fast(a): # Function is compiled to machine code when called the first time
    trace = 0
    # assuming square input matrix
    for i in range(a.shape[0]):   # Numba likes loops
        trace += np.tanh(a[i, i]) # Numba likes NumPy functions
    return a + trace              # Numba likes NumPy broadcasting

x = np.arange(100).reshape(10, 10)
go_fast(x)

go_fast(2*x)

%timeit go_fast(x)

np.testing.assert_array_equal(go_fast(x), go_fast.py_func(x))

%timeit go_fast.py_func(x)

def go_numpy(a):
    return a + np.tanh(np.diagonal(a)).sum()

np.testing.assert_array_equal(go_numpy(x), go_fast(x))

%timeit go_numpy(x)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章