Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.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
Tensorflow 我可以在RNNCell的调用中存储状态吗_Tensorflow - Fatal编程技术网

Tensorflow 我可以在RNNCell的调用中存储状态吗

Tensorflow 我可以在RNNCell的调用中存储状态吗,tensorflow,Tensorflow,我想为一个非常简单的单元构建我自己的RNNCell,其中输出为[-1,0,1],但是在我的_调用中,我会根据前面时间步的输出进行计算 所以我的问题是,是否有可能在_调用_方法中保留状态以在调用之间重用 class MyCell(RNNCell): # Size of my state # My state consists of 1 tensor with num_units columns @property def state_size(self):

我想为一个非常简单的单元构建我自己的RNNCell,其中输出为[-1,0,1],但是在我的_调用中,我会根据前面时间步的输出进行计算

所以我的问题是,是否有可能在_调用_方法中保留状态以在调用之间重用

class MyCell(RNNCell):
    # Size of my state
    # My state consists of 1 tensor with num_units columns
    @property
    def state_size(self):
        return self._num_units

    # I emit at every timestep
    @property
    def output_size(self):
        return self._num_units

    def __call__(self,input,state):
        #Intermediate calculations for 1 time step
        #Can i keep state here, for example info about last input
        #or output?
        return output, new_state
这对tf.dynamic\n不起作用,因此不鼓励使用。如果希望状态参数工作,请通过状态参数传递所有状态。它可能与普通tf.rnn一起工作,但不能保证