Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在tf.nn.rnn\u cell.MultiRNNCell中使用调用方法时,我是否可以更改退出率_Python_Tensorflow_Rnn - Fatal编程技术网

Python 在tf.nn.rnn\u cell.MultiRNNCell中使用调用方法时,我是否可以更改退出率

Python 在tf.nn.rnn\u cell.MultiRNNCell中使用调用方法时,我是否可以更改退出率,python,tensorflow,rnn,Python,Tensorflow,Rnn,下面是我如何定义MultiRNNCell的: n_lstm_cells = [tf.contrib.rnn.DropoutWrapper(tf.contrib.rnn.LSTMCell(hs), output_keep_prob=1-dropout_ph, variational_recur

下面是我如何定义MultiRNNCell的:

    n_lstm_cells = [tf.contrib.rnn.DropoutWrapper(tf.contrib.rnn.LSTMCell(hs),
                                                  output_keep_prob=1-dropout_ph,
                                                  variational_recurrent=True,
                                                  dtype=tf.float32) for hs in n_layer_sizes]
    n_multi_rnn_cell = tf.nn.rnn_cell.MultiRNNCell(n_lstm_cells)
    self.n_multi_rnn_cell = n_multi_rnn_cell
辍学者是一名plcaeholder。
当我在MultirnCell中使用
call
方法时,我可以更改辍学率吗? 以下是我在预测时如何使用call方法的示例:

note_output, new_state = self.n_multi_rnn_cell.call(inputs=indata,state=hidden)
我这样做而不是仅仅使用
tf.nn.dynamic\u rnn()
的原因是,在预测时,我需要每个步骤的输出,然后将此输出馈送到另一个rnn结构,以获得最终输出,作为
self.n\u multi\n\u cell
下一步的输入。在这个过程中,它还包括一些我自己定义的其他操作。我使用
tf.scan()
进行循环。

是否有一种方法可以将辍学率作为
调用
方法的输入之一?

我通过创建另一个在特定
tf.variable\u范围内具有共享(重用)权重的MultilRNCell来解决这个问题。当使用call方法时,我们需要将
tf.variable\u scope
指定给
'[您的作用域]/rnn/multi\u rnn\u cell'