-
args and kwargs for python
an exampledef func(*args, **kwargs): print ('args =', args) print ('kwargs = ', kwargs) print ('-----------', flush = True)if __name__ == '__main__': func('name', 11, 'a', 4) func(a = 'name', b = 11, c = 'a', d = 4) func('name',...…
-
math symbol for latex
1234…
-
math font for latex
usedmathbb:blackboard boldmathcal:calligraphy mathrm:math roman mathbf:math boldfaceothermathsfmathttmathitwidehatwidetildeoverlineillustration\begin{equation}\begin{aligned}&F(x, y) = F(x) + F(y), \\&\mathbb{F}(x, y) = \mathbb{F}(x) + \ma...…
-
some tricks on jupyter notebook
27 个Jupyter Notebook的小提示与技巧Jupyter notebook, 前身是 IPython notebook, 它是一个非常灵活的工具,有助于帮助你构建很多可读的分析,你可以在里面同时保留代码,图片,评论,公式和绘制的图像。Jupyter具有非常强的可扩展性,支持很多编程语言,并且易于部署到你的个人电脑和几乎所有的服务器上 -- 你只需要使用ssh或http接入即可。最重要的是,它完全免费。Jupyter默认设置使用 Python kernel,正因此以前叫做 IPy...…
-
some websit for latex presenation
PowerPointIt is usually used to create presentations.LaTexLaTeX can be used for creating presentations. i) WikiTemplatei) ShareLaTexii) overleafiii) LaTexTemplateiv) e.g.conference-presentation…
-
convert image format
a code#!/usr/bin/env python3.4import osimport reimport numpy as npimport uuidfrom scipy import miscimport numpy as npfrom PIL import Imageimport sysimport matplotlib.pyplot as plt def read(file): if file.endswith('.float3'): return readFloat(fi...…
-
list method for python
remove()list.remove(value)list = [2, 3, 4, 5, 6, 3] print(list)>> [2, 3, 4, 5, 6, 3]list.remove(3)print(list)>>[2, 4, 5, 6, 3]del()del list[index]list = [2, 3, 4, 5, 6, 3] print(list)>> [2, 3, 4, 5, 6, 3]del list[2]print(list)>...…
-
check g++ and gcc version in Ubuntu
check versiongcc --versiong++ --versionInstall versionsudo apt-get install -y gcc-4.7sudo apt-get install -y g++-4.7Update versioncd /usr/binsudo rm gccsudo ln -s gcc-4.7 gccsudo rm g++sudo ln -s g++-4.7 g++check versionls –al gcc g++gcc --version...…
-
One-hot function implementation in Pytorch
Some frequent one-hot method in PyTorchuse scatter_ functionlabels = [0, 1, 4, 7, 3, 2]one_hot = torch.zeros(6, 8).scatter_(dim = 1, index = labels, value = 1)use index_select() funtionlabels = [0, 1, 4, 7, 3, 2]index = torch.eye(8)one_hot = torch...…
-
tf.app.flags
tf.app.flags defines some parameter. A simple example:import tensorflow as tfFLAGS = tf.app.flags.FLAGStf.app.flags.DEFINE_float('learning_rate', 0.01, 'Initial learning rate.')tf.app.flags.DEFINE_string('train_dir', 'tmp/train/', 'Directory where...…