research/slim/nets/mobilenet/mobilenet_v2.py/mobilenet()函数
if activation_fn: #指定激活函数
conv_defs = copy.deepcopy(conv_defs) #为什么他们每一个都是复制一份conv_defs的参数配置???
defaults = conv_defs[‘defaults’]
下面参数更新是如何更新至conv_defs里面的
conv_defaults = ( defaults[(slim.conv2d, slim.fully_connected, slim.separable_conv2d)])#啥意思???? 答:从字典中拿value
{ 'normalizer_fn': slim.batch_norm, 'activation_fn': tf.nn.relu6 },
conv_defaults['activation_fn'] = activation_fn
chengwang@chengwang-16:/home/ssdisk/tsinghua/pr$ ipython3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
Type ‘copyright’, ‘credits’ or ‘license’ for more information
IPython 6.5.0 – An enhanced Interactive Python. Type ‘?’ for help.
In [1]:
In [1]:
In [1]:
In [1]: a={(1,2):{‘a’:‘hello’,‘b’:‘world’}}
In [2]: a
Out[2]: {(1, 2): {‘a’: ‘hello’, ‘b’: ‘world’}}
In [3]: b=a[(1,3)]
KeyError Traceback (most recent call last)
in ()
----> 1 b=a[(1,3)]
KeyError: (1, 3)
In [4]: b=a[(1,2)]
In [5]: b
Out[5]: {‘a’: ‘hello’, ‘b’: ‘world’}
In [6]: id(b)
Out[6]: 140320418670920
In [7]: id(a[(1,2)])
Out[7]: 140320418670920
In [8]: a
Out[8]: {(1, 2): {‘a’: ‘hello’, ‘b’: ‘world’}}
In [9]: b
Out[9]: {‘a’: ‘hello’, ‘b’: ‘world’}
In [10]: b[‘a’]=‘test’
In [11]: b
Out[11]: {‘a’: ‘test’, ‘b’: ‘world’}
In [12]: a
Out[12]: {(1, 2): {‘a’: ‘test’, ‘b’: ‘world’}}
In [13]: id(b)
Out[13]: 140320418670920