2022-02-07

WARNING: This article may be obsolete
This post was published in 2022-02-07. Obviously, expired content is less useful to users if it has already pasted its expiration date.
This article is categorized as "Garbage" . It should NEVER be appeared in your search engine's results.


Python函数的参数传递机制 *

(印象里以前好像写过,但是找不到了)

2022-10-13补充:结论:和mutable-immutable有关。代码写在下面。

🔗 [Python 的函数是怎么传递参数的? - 知乎] https://www.zhihu.com/question/20591688

这个问答下面的答案很多很杂(还有部分回答明确反对高票回答),所以暂时默认看这个回复:

Python 的函数是怎么传递参数的? - 石溪的回答 - 知乎 https://www.zhihu.com/question/20591688/answer/310617223

所以暂时和这张表一起记忆:mutable和immutable

https://truxton2blog.com/2021-10-19/

猜想:immutable类型传参->function内部可以修改,不会影响外部的数值;mutable传参->function内部修改会影响原本的数值。

下面搞一些程序来验证上面这张表的结果能否直接套用参数传递的规律:

int - immutable

def change(a):
    # change value of a
    a += 1
    print(a)


b = 99
change(b)
print(b)

# 100
# 99
# 所以外部的b并不会被改变

string - immutable

def change(a):
    # change value of a
    a+='.org'
    print(a)


b = "hltv"
change(b)
print(b)


# hltv.org
# hltv
# 所以外部的string类型(string类型是immutable)不会被改变

list - mutable

def change(a):
    # change value of a
    a.append(2)
    print(a)


b = [1]
change(b)
print(b)

# [1,2]
# [1,2]
# list的类型是mutable, 所以change(a)会改变外部的b(list)

set - mutable

def change(a):
    # change value of a
    a.add(2)
    print(a)


b = {1}
change(b)
print(b)

# {1, 2}
# {1, 2}
# set的类型是mutable, 所以change(a)会改变外部的b(list)

list - mutable

def change(a):
    # change value of a
    b["key2"]="value2"
    print(a)


b = {"key":"value"}
change(b)
print(b)

# {'key': 'value', 'key2': 'value2'}
# {'key': 'value', 'key2': 'value2'}
# dict的类型是mutable, 所以change(a)会改变外部的b(list)

python pure function

https://n3xtchen.github.io/n3xtchen/python/2014/08/04/python-functional-programming

更广泛定义的pure function

🔗 [Pure function - Wikipedia] https://en.wikipedia.org/wiki/Pure_function

继续复习C语言(接近0内容)


二维数组以及它的指针、取值、参数传递

(鸽了)


error: flexible array member not at end of struct

(待补充)

🔗 [关于C99中的Flexible array member个人理解 - 子虚乌有 - 博客园] https://www.cnblogs.com/cquccy/p/13366580.html

论文阅读:Deeply-Supervised Nets与Network in network

原文pdf:🔗 [1409.5185.pdf] https://arxiv.org/pdf/1409.5185.pdf

🔗 [论文解读:深度监督网络(Deeply-Supervised Nets) - 知乎] https://zhuanlan.zhihu.com/p/49492520

🔗 [[论文笔记] [2014] Deeply-Supervised Nets_Alexzhuan-CSDN博客] https://blog.csdn.net/qq_37524214/article/details/107115502

🔗 [[论文总结] Network In Network - 知乎] https://zhuanlan.zhihu.com/p/181718930

Feature map

🔗 [ CNN中feature map可视化有哪些思路和方法吗? - 知乎] https://www.zhihu.com/question/41529286/answer/93944672

Teacher & student network 与 知识蒸馏

🔗 [Teacher Student Model - 知乎] https://zhuanlan.zhihu.com/p/99513085

🔗 [知识蒸馏(Knowledge Distillation)简述(一) - 知乎] https://zhuanlan.zhihu.com/p/81467832


Label smoothing, Teacher & student network 与 知识蒸馏

🔗 [模型加速(三)知识蒸馏 - 墨殇浅尘 - 博客园] https://www.cnblogs.com/monologuesmw/p/13234804.html

Shared MLP

🔗 [Shared MLP Question · Issue #115 · charlesq34/pointnet] https://github.com/charlesq34/pointnet/issues/115

Global Average Pooling

🔗 [Global average pooling-- - 知乎] https://zhuanlan.zhihu.com/p/37683646

🔗 [深度学习基础系列(十)| Global Average Pooling是否可以替代全连接层? - 可可心心 - 博客园] https://www.cnblogs.com/hutao722/p/10008581.html



 Last Modified in 2023-02-01 

Leave a Comment Anonymous comment is allowed / 允许匿名评论