class Amygdala(object): def __init__(self): self.la = LA(la_size=1, la_map_size=(8, 8), la_in_size=3) self.ce = CE(in_size=1 * 8 * 8, out_size=2) def inference(self, xs, var=0.4): h = self.la.inference(xs, var) y = self.ce.inference(h) return y def update(self, t, lr_la=0.01, var_la=0.5, lr_ce=0.1): self.la.update(lr_la, var_la) self.ce.update(t, lr_ce)
class Amygdala(object): def __init__(self): self.la1 = LA(la_size=1, la_map_size=(8, 8), la_in_size=3 * 64 * 64) self.la2 = LA(la_size=1, la_map_size=(8, 8), la_in_size=3) self.ce = CE(in_size=2 * 8 * 8, out_size=3) def inference(self, x1, x2, var=0.4): h1 = self.la1.inference(x1, var) h2 = self.la2.inference(x2, var) h = np.concatenate((h1, h2), axis=1) y = self.ce.inference(h) return y def update(self, t, lr_la=0.01, var_la=0.5, lr_ce=0.1): self.la1.update(lr_la, var_la) self.la2.update(lr_la, var_la) self.ce.update(t, lr_ce)