コード例 #1
0
ファイル: models.py プロジェクト: lgelderloos/reimaginet
 def __init__(self,
              size_vocab,
              size_embed,
              size,
              size_out,
              depth,
              gru_activation=clipped_rectify,
              visual_encoder=StackedGRUH0,
              visual_activation=linear,
              dropout_prob=0.0):
     autoassign(locals())
     self.Embed = Embedding(self.size_vocab, self.size_embed)
     self.Visual = Visual(self.size_embed,
                          self.size,
                          self.size_out,
                          self.depth,
                          encoder=self.visual_encoder,
                          gru_activation=self.gru_activation,
                          visual_activation=self.visual_activation,
                          dropout_prob=self.dropout_prob)
     self.LM = StackedGRUH0(self.size_embed,
                            self.size,
                            self.depth,
                            activation=self.gru_activation,
                            dropout_prob=self.dropout_prob)
     self.ToTxt = Dense(self.size, self.size_vocab)  # map to vocabulary
コード例 #2
0
ファイル: models.py プロジェクト: lgelderloos/reimaginet
 def __init__(self,
              size_vocab,
              size_embed,
              size,
              size_out,
              depth,
              depth_spec=1,
              visual_encoder=StackedGRUH0,
              gru_activation=clipped_rectify,
              visual_activation=linear,
              dropout_prob=0.0):
     autoassign(locals())
     self.Embed = Embedding(self.size_vocab, self.size_embed)
     self.Shared = StackedGRUH0(self.size_embed,
                                self.size,
                                self.depth,
                                activation=self.gru_activation,
                                dropout_prob=self.dropout_prob)
     self.Visual = Visual(self.size,
                          self.size,
                          self.size_out,
                          self.depth_spec,
                          encoder=self.visual_encoder,
                          gru_activation=self.gru_activation,
                          visual_activation=self.visual_activation,
                          dropout_prob=self.dropout_prob)
     self.LM = StackedGRU(self.size,
                          self.size,
                          self.depth_spec,
                          activation=self.gru_activation,
                          dropout_prob=self.dropout_prob)
     self.ToTxt = Dense(self.size, self.size_embed)  # try direct softmax
コード例 #3
0
    def __init__(self, size_vocab, size_embed, size, depth):
        autoassign(locals())

        self.Embed = Embedding(self.size_vocab, self.size_embed)
        self.GRU = StackedGRUH0(self.size_embed,
                                self.size,
                                self.depth,
                                activation=clipped_rectify)
コード例 #4
0
ファイル: old_models.py プロジェクト: lgelderloos/reimaginet
 def __init__(self, size_vocab, size_embed, size, size_out, depth, out_depth=1, # FIXME USE THIS PARAM
              gru_activation=tanh, visual_activation=linear,
              dropout_prob=0.0):
     autoassign(locals())
     self.Embed = Embedding(self.size_vocab, self.size_embed)
     self.Encode = StackedGRUH0(self.size_embed, self.size, self.depth,
                                activation=self.gru_activation, dropout_prob=self.dropout_prob)
     self.DecodeT = StackedGRU(self.size_embed, self.size, self.depth,
                               activation=self.gru_activation, dropout_prob=self.dropout_prob)
     self.PredictT   = Dense(size_in=self.size, size_out=self.size_embed)
     self.DecodeV = Dense(self.size, self.size_out)
     self.params = params(self.Embed, self.DecodeT, self.PredictT, self.DecodeV) 
コード例 #5
0
ファイル: old_models.py プロジェクト: lgelderloos/reimaginet
 def __init__(self, size_vocab, size_embed, size, size_out, depth, textual,
              out_depth=1,
              gru_activation=tanh,
              visual_activation=linear,
              dropout_prob=0.0):
     autoassign(locals())
     self.Embed   =  Embedding(self.size_vocab, self.size_embed)
     self.Visual  = Visual(self.size_embed, self.size, self.size_out, self.depth, out_depth=self.out_depth,
                           gru_activation=self.gru_activation, dropout_prob=self.dropout_prob)
     self.Textual = textual(self.size_embed, self.size, self.size_out, self.depth,
                            gru_activation=self.gru_activation, dropout_prob=self.dropout_prob)
     self.params  = params(self.Embed, self.Visual, self.Textual)