@@ -125,37 +125,33 @@ type Layer interface {
125125 // Note: this is a global list so do not modify!
126126 UnitVarProps () map [string ]string
127127
128+ // UnitVarIdx returns the index of given variable within the Neuron,
129+ // according to *this layer's* UnitVarNames() list (using a map to lookup index),
130+ // or -1 and error message if not found.
131+ UnitVarIdx (varNm string ) (int , error )
132+
133+ // UnitVal1D returns value of given variable index on given unit, using 1-dimensional index.
134+ // returns NaN on invalid index.
135+ // This is the core unit var access method used by other methods,
136+ // so it is the only one that needs to be updated for derived layer types.
137+ UnitVal1D (varIdx int , idx int ) float32
138+
128139 // UnitVals fills in values of given variable name on unit,
129140 // for each unit in the layer, into given float32 slice (only resized if not big enough).
130141 // Returns error on invalid var name.
131- UnitVals (vals * []float32 , varnm string ) error
142+ UnitVals (vals * []float32 , varNm string ) error
132143
133144 // UnitValsTensor fills in values of given variable name on unit
134145 // for each unit in the layer, into given tensor.
135146 // If tensor is not already big enough to hold the values, it is
136147 // set to the same shape as the layer.
137148 // Returns error on invalid var name.
138- UnitValsTensor (tsr etensor.Tensor , varnm string ) error
149+ UnitValsTensor (tsr etensor.Tensor , varNm string ) error
139150
140151 // UnitVal returns value of given variable name on given unit,
141152 // using shape-based dimensional index.
142- // returns nil on invalid var name or index -- see Try version for error message.
143- UnitVal (varnm string , idx []int ) float32
144-
145- // UnitValTry returns value of given variable name on given unit,
146- // using shape-based dimensional index.
147- // returns error message if var name not found or invalid index.
148- UnitValTry (varnm string , idx []int ) (float32 , error )
149-
150- // UnitVal1D returns value of given variable name on given unit,
151- // using 1-dimensional index.
152- // returns nil on invalid var name or index -- see Try version for error message.
153- UnitVal1D (varnm string , idx int ) float32
154-
155- // UnitVal1DTry returns value of given variable name on given unit,
156- // using 1-dimensional index.
157- // returns error message if var name not found or invalid index.
158- UnitVal1DTry (varnm string , idx int ) (float32 , error )
153+ // Returns NaN on invalid var name or index.
154+ UnitVal (varNm string , idx []int ) float32
159155
160156 // RecvPrjns returns the full list of receiving projections
161157 RecvPrjns () * Prjns
0 commit comments