def model(ps): src = tf.Input(shape=(ps.len_src, ), dtype='int32') typ = tf.Input(shape=(ps.len_src, ), dtype='int32') hint = tf.Input(shape=(ps.len_tgt, ), dtype='int32') tgt = tf.Input(shape=(ps.len_tgt, ), dtype='int32') ins = [src, typ, hint, tgt] outs = [Trafo(ps)(ins)] m = tf.Model(name='TrafoModel', inputs=ins, outputs=outs) return m
def model_old(ps): w, h = ps.img_width, ps.img_height ins = [ tf.Input(shape=(w * h, ), dtype='float32'), tf.Input(shape=(w * h, ), dtype='float32'), tf.Input(shape=(1, ), dtype='int32'), tf.Input(shape=(w * h, ), dtype='float32'), tf.Input(shape=(1, ), dtype='int32'), ] outs = [Mnist(ps)(ins)] m = tf.Model(name='MnistModel', inputs=ins, outputs=outs) return m
def model(ps): seq = tf.Input(shape=(), dtype=tf.float32) typ = tf.Input(shape=(), dtype=tf.float32) opt = tf.Input(shape=(), dtype=tf.float32) beg = tf.Input(shape=(), dtype=tf.float32) end = tf.Input(shape=(), dtype=tf.float32) uid = tf.Input(shape=(), dtype=tf.float32) ins = [seq, typ, opt, beg, end, uid] y = Squad(ps)([seq, typ]) outs = [SquadLoss(ps)([beg, end], y)] m = tf.Model(name='SquadModel', inputs=ins, outputs=outs) return m
def model(ps): sh = (ps.len_src, ) src = tf.Input(shape=sh, dtype='int32', name='src') typ = tf.Input(shape=sh, dtype='int32', name='typ') sh = (ps.len_tgt, ) idx = tf.Input(shape=sh, dtype='int32', name='mlm_idx') val = tf.Input(shape=sh, dtype='int32', name='mlm_val') fit = tf.Input(shape=sh, dtype='bool', name='fit') mlm = tf.Input(shape=sh, dtype='float32', name='mlm') ins = [src, typ, fit, idx, val, mlm] outs = [Bert(ps)(ins)] m = tf.Model(name='BertModel', inputs=ins, outputs=outs) return m