更新时间:2023-12-02 12:11:16
是否要为RNN单元或密集层设置权重?如果用于RNN单元,则应该能够使用
Do you want to set weights for the RNN Cell or for the Dense layer? If it's for the RNN cell, you should be able to set the weights using the set_weights method.
如果用于密集层,则您应该能够分配 Variable
并使用initializer
参数传递您的权重(以及其他偏见).然后,当您调用layers.dense
时,可以将变量张量分别传递给kernel_initializer
和bias_initializer
以获得权重和偏差.
If it's for the Dense layer, you should be able to assign a Variable
and use the initializer
argument to pass your weights (and another for the bias'). Then, when you call layers.dense
, you can pass both your variable tensors to kernel_initializer
and bias_initializer
for weights and biases respectively.