Example #1
0
    def __init__(self, args):
        super(FFN, self).__init__()

        self.mlp = MLP(in_size=args.hidden_size,
                       mid_size=args.ff_size,
                       out_size=args.hidden_size,
                       dropout_r=args.dropout_r,
                       use_relu=True)
Example #2
0
    def __init__(self, args):
        super(AttFlat, self).__init__()
        self.args = args

        self.mlp = MLP(in_size=args.hidden_size,
                       mid_size=args.flat_mlp_size,
                       out_size=args.flat_glimpses,
                       dropout_r=args.dropout_r,
                       use_relu=True)

        self.linear_merge = nn.Linear(args.hidden_size * args.flat_glimpses,
                                      args.hidden_size * 2)
Example #3
0
    def __init__(self, args, flat_glimpse, merge=False):
        super(AttFlat, self).__init__()
        self.args = args
        self.merge = merge
        self.flat_glimpse = flat_glimpse
        self.mlp = MLP(in_size=args.hidden_size,
                       mid_size=args.ff_size,
                       out_size=flat_glimpse,
                       dropout_r=args.dropout_r,
                       use_relu=True)

        if self.merge:
            self.linear_merge = nn.Linear(args.hidden_size * flat_glimpse,
                                          args.hidden_size * 2)