2017-03-06 7 views
0

私はRNNCell(出力が[-1,0,1]の非常に単純なセル)を作成したいと思いますが、__call__では前のタイムステップの出力。RNNCellの__call__に状態を保存することはできますか

私の質問は、__call__メソッドの状態を呼び出し間で再利用できるかどうかです。

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 

答えて

1

これはtf.dynamic_rnnとは機能しませんのでお勧めできません。あなたがそれを動作させたい場合は、すべての状態をstate引数で渡します。プレーンテキストtf.rnnで動作するかもしれませんが、保証されません。

関連する問題