Skip to content

Commit

Permalink
more general options for weight saving: MetaVals for prjn (for SWtMe…
Browse files Browse the repository at this point in the history
…ans), Wt1, Wt2 generic extra weight vals.
  • Loading branch information
Randall C. O'Reilly committed May 24, 2021
1 parent 861da36 commit a3ec8fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions weights/cpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func NetReadCpp(r io.Reader) (*Network, error) {
if len(rw.Si) != nc {
rw.Si = make([]int, nc)
rw.Wt = make([]float32, nc)
rw.Scale = make([]float32, nc)
rw.Wt1 = make([]float32, nc)
}
cidx = 0 // start reading on next ones
continue
Expand Down Expand Up @@ -134,7 +134,7 @@ func NetReadCpp(r io.Reader) (*Network, error) {
}
rw.Si[cidx] = si
rw.Wt[cidx] = float32(wt)
rw.Scale[cidx] = float32(0)
rw.Wt1[cidx] = float32(0)
cidx++
case 3:
si, err := strconv.Atoi(siwts[0])
Expand All @@ -151,7 +151,7 @@ func NetReadCpp(r io.Reader) (*Network, error) {
}
rw.Si[cidx] = si
rw.Wt[cidx] = float32(wt)
rw.Scale[cidx] = float32(scale)
rw.Wt1[cidx] = float32(scale)
cidx++
default:
err = fmt.Errorf("NetReadCpp: unrecognized input: %v", bs)
Expand Down
14 changes: 8 additions & 6 deletions weights/wts.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func (ly *Layer) SetMetaData(key, val string) {
// Prjn is temp structure for holding decoded weights, one for each projection
type Prjn struct {
From string
MetaData map[string]string // used for optional prjn-level params, metadata such as GScale
MetaData map[string]string // used for optional prjn-level params, metadata such as GScale
MetaVals map[string][]float32 // optional values at the projection level
Rs []Recv
}

Expand All @@ -49,9 +50,10 @@ func (pj *Prjn) SetMetaData(key, val string) {

// Recv is temp structure for holding decoded weights, one for each recv unit
type Recv struct {
Ri int
N int
Si []int
Wt []float32
Scale []float32
Ri int
N int
Si []int
Wt []float32
Wt1 []float32 // call extra synapse-level vars 1,2..
Wt2 []float32 // call extra synapse-level vars 1,2..
}

0 comments on commit a3ec8fa

Please sign in to comment.