接受不定参数
1 | def add(x, *args): |
这里,*args
表示参数数目不定,可以看成一个元组,把第一个参数后面的参数当作元组中的元素。
1 | print(add(1, 2, 3, 4)) |
1 | def add(x, **kwargs): |
这里, **kwargs
表示参数数目不定,相当于一个字典,关键词和值对应于键值对。
1 | print add(10, y=11, z=12, w=13) |
1 | def foo(*args, **kwargs): |
tf 里面的training=True
Some neural network layers behave differently during training and inference, for example Dropout and BatchNormalization layers. For example
- During training, dropout will randomly drop out units and correspondingly scale up activations of the remaining units.
- During inference, it does nothing (since you usually don’t want the randomness of dropping out units here).
The training argument lets the layer know which of the two “paths” it should take. If you set this incorrectly, your network might not behave as expected.
pycharm的奇技淫巧
https://www.zhihu.com/question/37787004
为什么要做归一化处理
https://mp.weixin.qq.com/s/TF6d9NRz0lDFQeC_K3CVaw
npy 格式的好处
https://towardsdatascience.com/what-is-npy-files-and-why-you-should-use-them-603373c78883
- 不用reshape了,什么格式保存,什么格式读取
- storage比较小
- Read的速度比较快
pickle data
https://www.geeksforgeeks.org/understanding-python-pickling-example/
https://www.zhihu.com/search?type=content&q=Pickling
答:Pickle模块读入任何Python对象,将它们转换成字符串,然后使用dump函数将其转储到一个文件中——这个过程叫做pickling。反之从存储的字符串文件中提取原始Python对象的过程,叫做unpickling。 allow_pickle = True文件传输的过程中可能会有压缩,true则表示压缩后文件不变
Python的面试
https://zhuanlan.zhihu.com/p/41962762
1.这两个参数是什么意思:*args,\kwargs?我们为什么要使用它们?**
答:如果我们不确定往一个函数中传入多少参数,或者我们希望以元组(tuple)或者列表(list)的形式传参数的时候,我们可以使用*args(单星号).如果我们不知道往函数中传递多少个关键词参数或者想传入字典的值作为关键词参数的时候我们可以使用**kwargs(双星号),args,kwargs两个标识符是约定俗成的用法。
lists are mutable while tuple are not
这个就非常的好,解释kargs and args
https://realpython.com/python-kwargs-and-args/
https://www.jianshu.com/p/592cf526b1e6
https://www.scaler.com/topics/python/args-and-kwargs-in-python/
https://wiingy.com/learn/python/args-and-kwargs-in-python/
Python 的iteration 这个模块的用法
https://www.zhihu.com/search?type=content&q=itertools
Itertools.zip_longest()
This iterator falls under the category of Terminating Iterators. It prints the values of iterables alternatively in sequence. If one of the iterables is printed fully, the remaining values are filled by the values assigned to fillvalue parameter.
Python新手常见的坑
https://zhuanlan.zhihu.com/p/81012511
Tf.function 装饰器的玩意
func | the function to be compiled. If func is None, tf.function returns a decorator that can be invoked with a single argument - func. In other words, tf.function(input_signature=…)(func) is equivalent to tf.function(func, input_signature=…). The former can be used as decorator. |
---|---|
input_signature | A possibly nested sequence of tf.TensorSpec objects specifying the shapes and dtypes of the Tensors that will be supplied to this function. If None, a separate function is instantiated for each inferred input signature. If input_signature is specified, every input to func must be a Tensor, and func cannot accept **kwargs. |
tf graph:
Graphs are data structures that contain a set of tf.Operation objects, which represent units of computation; and tf.Tensor objects, which represent the units of data that flow between operations. They are defined in a tf.Graph context. Since these graphs are data structures, they can be saved, run, and restored all without the original Python code.
permutation invariant
In this context this refers to the fact that the model does not assume any spatial relationships between the features. E.g. for multilayer perceptron, you can permute the pixels and the performance would be the same. This is not the case for convolutional networks, which assume neighbourhood relations.
numpy -1 的作用
https://stackoverflow.com/questions/tagged/numpy-ndarray
Tensorflow.Dataset中map,shuffle,repeat,batch的总结
https://blog.csdn.net/anshuai_aw1/article/details/105094548
shuffle的顺序很重要,应该先shuffle再batch,如果先batch后shuffle的话,那么此时就只是对batch进行shuffle,而batch里面的数据顺序依旧是有序的,那么随机程度会减弱
buffer_size 越大,打乱的程度越高
https://www.cnblogs.com/HolyShine/p/8673322.html
数据集的处理和预处理,非常重要
https://tf.wiki/zh_hans/basic/tools.html#zh-hans-tfdata
Tensorflow Dataset API 用法
https://zhuanlan.zhihu.com/p/30751039
Tensorflow 数据读取机制
https://zhuanlan.zhihu.com/p/27238630
训练gpu的tricks
https://zhuanlan.zhihu.com/p/53345706
\tensorflow的训练和教程(非常重要)
python的包之类的问题
https://www.zhihu.com/question/430339227/answer/1577177268
Python __init__之类的问题
https://www.zhihu.com/question/46973549/answer/767530541
nohup
https://www.zhihu.com/question/429726293/answer/1568963793
Pycharm 的debug
https://www.zhihu.com/search?type=content&q=pycharm%E6%96%AD%E7%82%B9debug
五分钟学算法
python浅拷贝
https://mp.weixin.qq.com/s/KrdXyYMtyElUGuPH5eNYvg
爬取b站的弹幕
https://mp.weixin.qq.com/s/OYo1VwKkUWIX9p73mvSLOQ
表情包
https://mp.weixin.qq.com/s/0Yguofg54GZSjvfUfjezmw
爬去百度的表格
https://blog.csdn.net/wyquin/article/details/79601918
python 的项目组织结构
爬虫403问题
Matplot 问题总结
https://www.jianshu.com/p/778d78463028
爬虫csdn 大全
https://blog.csdn.net/llllllkkkkkooooo/category_10129586.html
阿里云部署 flask
- Post title:python 相关的知识和笔记链接
- Post author:Yuxuan Wu
- Create time:2021-01-28 01:57:29
- Post link:yuxuanwu17.github.io2021/01/28/python-相关的知识和笔记链接/
- Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.