Exemple #1
0
 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
Exemple #2
0
 def __init__(self, size_embed, size, size_out, depth, gru_activation=tanh, dropout_prob=0.0):
     autoassign(locals())
     self.Encode  = StackedGRU(self.size_embed, self.size, self.depth,
                                 activation=self.gru_activation, dropout_prob=self.dropout_prob)
     self.FromImg = Dense(self.size_out, self.size)
     self.Predict = Dense(self.size, self.size_embed)
     self.params = params(self.Encode, self.FromImg, self.Predict) 
Exemple #3
0
 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) 
Exemple #4
0
 def __init__(self, size_embed, size, size_out, depth, gru_activation=tanh, dropout_prob=0.0):
     autoassign(locals())
     encoder = lambda size_in, size:\
               StackedGRUH0(size_embed, size, self.depth,
                            activation=self.gru_activation, dropout_prob=self.dropout_prob)
     decoder = lambda size_in, size: \
               StackedGRU(size_embed, size, self.depth,
                          activation=self.gru_activation, dropout_prob=self.dropout_prob)
     self.Encdec   = EncoderDecoderGRU(self.size, self.size, self.size, 
                                       encoder=encoder,
                                       decoder=decoder)
     self.Predict   = Dense(size_in=self.size, size_out=self.size_embed)
     self.params    = params(self.Encdec, self.Predict)