在Tensorflow中,来自Caffe的weight_filler”高斯”等于什么?

What is the equivalent of weight_filler “gaussian” from Caffe in Tensorflow?

我正在尝试将Caffe模型转换为tensorflow。在Caffe中,我的卷积初始化如下:

1
2
3
4
5
6
7
8
weight_filler {
  type:"gaussian"
  std: 0.01
}
bias_filler {
  type:"constant"
  value: 0
}

如何在Tensorflow中获得相同的初始化?


使用tf.truncated_normal,您可以从截断的随机分布中获取随机值,因此:

1
2
3
shape = [10,10] # variable shape
weight = tf.Variable(tf.truncated_normal(shape, mean=0.0, stddev=0.01))
bias = tf.Variable(0.)