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)
def __init__(self, size_vocab, size_embed, size, size_out, depth, gru_activation=clipped_rectify, visual_activation=linear, visual_encoder=StackedGRUH0, 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 = 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.ToTxt = Dense(self.size, self.size_embed) # try direct softmax
def __init__(self, size_in, size, depth=2, dropout_prob=0.0, activation=tanh): autoassign(locals()) self.bottom = Dense(self.size_in, self.size) layers = [ Dense(self.size, self.size) for _ in range(1, self.depth) ] self.stack = reduce(lambda z, x: \ x.compose(WithDropout(Activation(self.activation).compose(z), self.dropout_prob)), \ layers, \ self.bottom) self.params = self.stack.params
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)
def __init__(self, size_repr, size_hidden=200, size_classify=3, activation=tanh, dropout=0.0): autoassign(locals()) self.Dropout = Dropout(prob=self.dropout) self.L1 = WithDropout(Dense(self.size_repr * 2, self.size_hidden), prob=dropout) self.L2 = WithDropout(Dense(self.size_hidden, self.size_hidden), prob=dropout) self.L3 = WithDropout(Dense(self.size_hidden, self.size_hidden), prob=dropout) self.classify = Dense(self.size_hidden, self.size_classify) self.params = util.params(self.Dropout, self.L1, self.L2, self.L3, self.classify)
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)
def __init__(self, size_vocab, size_embed, size, depth, size_target, max_norm=None, lr=0.0002): autoassign(locals()) self.updater = util.Adam(max_norm=self.max_norm, lr=self.lr) self.Encode = Encoder(self.size_vocab, self.size_embed, self.size, self.depth) self.ToImg = Dense(self.size, self.size_target) self.inputs = [T.imatrix()] self.target = T.fmatrix()
def __init__(self, size_embed, size, size_out, depth, encoder=StackedGRUH0, gru_activation=clipped_rectify, visual_activation=linear, dropout_prob=0.0): autoassign(locals()) self.Encode = encoder(self.size_embed, self.size, self.depth, activation=self.gru_activation, dropout_prob=self.dropout_prob) self.ToImg = Dense(self.size, self.size_out)
def __init__(self, size_embed, size, size_out, depth, out_depth=1, gru_activation=tanh, dropout_prob=0.0): autoassign(locals()) self.Encode = StackedGRUH0(self.size_embed, self.size, self.depth, activation=self.gru_activation, dropout_prob=self.dropout_prob) self.Project = Dense(self.size, self.size_out) self.params = params(self.Encode, self.Project)
def __init__(self, size_repr, size_classify=3, dropout=0.0): autoassign(locals()) self.Dropout = Dropout(prob=self.dropout) self.classify = Dense(self.size_repr * 2, self.size_classify) self.params = util.params(self.Dropout, self.classify)