【问题标题】:What is the equivalent of weight_filler "gaussian" from Caffe in Tensorflow?Tensorflow 中 Caffe 中的 weight_filler“高斯”等价物是什么?
【发布时间】:2021-03-11 03:54:01
【问题描述】:

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

weight_filler {
  type: "gaussian"
  std: 0.01
}
bias_filler {
  type: "constant"
  value: 0
}

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

【问题讨论】:

    标签: tensorflow caffe


    【解决方案1】:

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

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

    【讨论】:

    • 我最终使用了initializer=tf.truncated_normal_initializer(mean=0.0,stddev=0.01)。感谢您的帮助
    猜你喜欢
    • 2020-10-18
    • 2017-06-05
    • 2017-01-14
    • 2019-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-22
    • 2019-11-11
    相关资源
    最近更新 更多