tensorflow api:
http://wiki.jikexueyuan.com/project/tensorflow-zh/api_docs/python/index.html
tensorflow 官网api:
http://www.tensorfly.cn/tfdoc/api_docs/python/index.html
tensorflow例子:
https://github.com/aymericdamien/TensorFlow-Examples
tensorflow slim:
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/slim
slim.arg_scope:提供了一个新的范围:这个范围的名字叫做arg_scope,在这个范围下用户对特定的操作自己定义默认的输入
with arg_scope([layers.conv2d], padding='SAME',
initializer=layers.variance_scaling_initializer(),
regularizer=layers.l2_regularizer(0.05)):
net = layers.conv2d(inputs, 64, [11, 11], 4, padding='VALID', scope='conv1')
net = layers.conv2d(net, 256, [5, 5], scope='conv2')
The first call to conv2d will use predefined args:
layers.conv2d(inputs, 64, [11, 11], 4, padding='VALID', ..., scope='conv1')
The second call to conv2d will overwrite padding:
layers.conv2d(inputs, 256, [5, 5], padding='SAME', ..., scope='conv2')
注意initializer和regularizer参数都是layers.conv2d的参数
arg_scope的重复使用
with arg_scope([layers.conv2d], padding='SAME',
initializer=layers.variance_scaling_initializer(),
regularizer=layers.l2_regularizer(0.05)) as sc:
net = layers.conv2d(net, 256, [5, 5], scope='conv1')
with arg_scope(sc):
net = layers.conv2d(net, 256, [5, 5], scope='conv2')
variable_scope返回的是变量上下文
tf.variable_scope(‘squeezenet’, [images], reuse=True)
其中第一个参数是变量域的名字,第二个是list,是初始化值,reuse是否重复使用
原型:
tf.variable_scope(name_or_scope, reuse=None, initializer=None)