2016-09-25 61 views
2

我有两个巨大的numpy权重和偏差阵列的CNN。我可以为每个图层设置权重(使用set_weights),但我没有看到为每个图层设置偏差的方法。我该怎么做呢?在CNN设置偏差

回答

0

您可以使用layer.set_weights(weights)来完成此操作。从文档:

weights: a list of Numpy arrays. The number 
     of arrays and their shape must match 
     number of the dimensions of the weights 
     of the layer (i.e. it should match the 
     output of `get_weights`). 

你不只是把权重过滤器在那里,但对于每个参数的层。您必须输入砝码的顺序取决于layer.weights。您可以查看代码或通过做类似

print([p.name for p in layer.weights]) 
打印图层权重的名称