Beispiel #1
0
 def SetParams(ss, sheet, setMsg):
     """
     SetParams sets the params for "Base" and then current ParamSet.
     If sheet is empty, then it applies all avail sheets (e.g., Network, Sim)
     otherwise just the named sheet
     if setMsg = true then we output a message for each param that was set.
     """
     if sheet == "":
         ss.Params.ValidateSheets(go.Slice_string(["Network", "Sim"]))
     ss.SetParamsSet("Base", sheet, setMsg)
     if ss.ParamSet != "" and ss.ParamSet != "Base":
         sps = ss.ParamSet.split()
         for ps in sps:
             ss.SetParamsSet(ps, sheet, setMsg)
     nt = ss.Net
     v1 = leabra.Layer(nt.LayerByName("V1"))
     elat = leabra.Prjn(v1.RcvPrjns[2])
     elat.WtScale.Rel = ss.ExcitLateralScale
     elat.Learn.Learn = ss.ExcitLateralLearn
     ilat = leabra.Prjn(v1.RcvPrjns[3])
     ilat.WtScale.Abs = ss.InhibLateralScale
Beispiel #2
0
 def LesionUnit(ss, lay, unx, uny):
     """
     LesionUnit lesions given unit number in given layer by setting all weights to 0
     """
     ui = etensor.Prjn2DIdx(lay.Shape(), False, uny, unx)
     rpj = lay.RecvPrjns()
     for pji in rpj:
         pj = leabra.Prjn(handle=pji)  # todo: not clear why handle needed here?
         nc = int(pj.RConN[ui])
         st = int(pj.RConIdxSt[ui])
         for ci in range(nc):
             rsi = pj.RSynIdx[st+ci]
             sy = pj.Syns[rsi]
             sy.Wt = 0
             pj.Learn.LWtFmWt(sy)
Beispiel #3
0
 def SetParamsSet(ss, setNm, sheet, setMsg):
     """
     SetParamsSet sets the params for given params.Set name.
     If sheet is empty, then it applies all avail sheets (e.g., Network, Sim)
     otherwise just the named sheet
     if setMsg = true then we output a message for each param that was set.
     """
     pset = ss.Params.SetByNameTry(setNm)
     if sheet == "" or sheet == "Network":
         if "Network" in pset.Sheets:
             netp = pset.SheetByNameTry("Network")
             ss.Net.ApplyParams(netp, setMsg)
         hid = leabra.Layer(ss.Net.LayerByName("Hidden"))
         fmhid = leabra.Prjn(hid.RcvPrjns.SendName("Hidden"))
         fmhid.WtInit.Mean = ss.RecurrentWt
     if sheet == "" or sheet == "Sim":
         if "Sim" in pset.Sheets:
             simp = pset.SheetByNameTry("Sim")
             pyparams.ApplyParams(ss, simp, setMsg)
             simp.Apply(ss, setMsg)