Documentation
¶
Index ¶
- Constants
- func JsonToParams(b []byte) string
- type Layer
- func (ly *Layer) AddNetinActBiasVars()
- func (ly *Layer) AddVar(varNm string)
- func (ly *Layer) AddVars(varNms []string)
- func (ly *Layer) AllParams() string
- func (ly *Layer) ApplyParams(pars *params.Sheet, setMsg bool) (bool, error)
- func (ly *Layer) Build() error
- func (ly *Layer) BuildPrjns() error
- func (ly *Layer) BuildVarNames()
- func (ly *Layer) Class() string
- func (ly *Layer) Config(shape []int, typ emer.LayerType)
- func (ly *Layer) Defaults()
- func (ly *Layer) Idx4DFrom2D(x, y int) ([]int, bool)
- func (ly *Layer) Index() int
- func (ly *Layer) InitName(lay emer.Layer, name string, net emer.Network)
- func (ly *Layer) Is2D() bool
- func (ly *Layer) Is4D() bool
- func (ly *Layer) IsOff() bool
- func (ly *Layer) Label() string
- func (ly *Layer) NPools() int
- func (ly *Layer) NRecvPrjns() int
- func (ly *Layer) NSendPrjns() int
- func (ly *Layer) Name() string
- func (ly *Layer) NonDefaultParams() string
- func (ly *Layer) Pos() mat32.Vec3
- func (ly *Layer) ReadWtsJSON(r io.Reader) error
- func (ly *Layer) RecipToSendPrjn(spj emer.Prjn) (emer.Prjn, bool)
- func (ly *Layer) RecvPrjn(idx int) emer.Prjn
- func (ly *Layer) RecvPrjnVals(vals *[]float32, varNm string, sendLay emer.Layer, sendIdx1D int, ...) error
- func (ly *Layer) RecvPrjns() *emer.Prjns
- func (ly *Layer) RelPos() relpos.Rel
- func (ly *Layer) SendPrjn(idx int) emer.Prjn
- func (ly *Layer) SendPrjnVals(vals *[]float32, varNm string, recvLay emer.Layer, recvIdx1D int, ...) error
- func (ly *Layer) SendPrjns() *emer.Prjns
- func (ly *Layer) SetClass(cls string)
- func (ly *Layer) SetIndex(idx int)
- func (ly *Layer) SetName(nm string)
- func (ly *Layer) SetOff(off bool)
- func (ly *Layer) SetPos(pos mat32.Vec3)
- func (ly *Layer) SetRelPos(rel relpos.Rel)
- func (ly *Layer) SetShape(shape []int)
- func (ly *Layer) SetThread(thr int)
- func (ly *Layer) SetType(typ emer.LayerType)
- func (ly *Layer) SetWts(lw *weights.Layer) error
- func (ly *Layer) Shape() *etensor.Shape
- func (ly *Layer) Size() mat32.Vec2
- func (ly *Layer) Thread() int
- func (ly *Layer) Type() emer.LayerType
- func (ly *Layer) TypeName() string
- func (ly *Layer) UnitVal(varNm string, idx []int) float32
- func (ly *Layer) UnitVal1D(varIdx int, idx int) float32
- func (ly *Layer) UnitVals(vals *[]float32, varNm string) error
- func (ly *Layer) UnitValsTensor(tsr etensor.Tensor, varNm string) error
- func (ly *Layer) UnitVarIdx(varNm string) (int, error)
- func (ly *Layer) UnitVarNames() []string
- func (ly *Layer) UnitVarNum() int
- func (ly *Layer) UnitVarProps() map[string]string
- func (ly *Layer) UpdateParams()
- func (ly *Layer) VarRange(varNm string) (min, max float32, err error)
- func (ly *Layer) WriteWtsJSON(w io.Writer, depth int)
- type Network
- func (nt *Network) AddLayer(name string, shape []int, typ emer.LayerType) emer.Layer
- func (nt *Network) AddLayer2D(name string, shapeY, shapeX int, typ emer.LayerType) emer.Layer
- func (nt *Network) AddLayer4D(name string, nPoolsY, nPoolsX, nNeurY, nNeurX int, typ emer.LayerType) emer.Layer
- func (nt *Network) AddLayerInit(ly emer.Layer, name string, shape []int, typ emer.LayerType)
- func (nt *Network) AllParams() string
- func (nt *Network) ApplyParams(pars *params.Sheet, setMsg bool) (bool, error)
- func (nt *Network) BidirConnectLayerNames(low, high string, pat prjn.Pattern) (lowlay, highlay emer.Layer, fwdpj, backpj emer.Prjn, err error)
- func (nt *Network) BidirConnectLayers(low, high emer.Layer, pat prjn.Pattern) (fwdpj, backpj emer.Prjn)
- func (nt *Network) BidirConnectLayersPy(low, high emer.Layer, pat prjn.Pattern)
- func (nt *Network) Bounds() (min, max mat32.Vec3)
- func (nt *Network) BoundsUpdt()
- func (nt *Network) Build() error
- func (nt *Network) BuildVarNames()
- func (nt *Network) ConnectLayerNames(send, recv string, pat prjn.Pattern, typ emer.PrjnType) (rlay, slay emer.Layer, pj emer.Prjn, err error)
- func (nt *Network) ConnectLayers(send, recv emer.Layer, pat prjn.Pattern, typ emer.PrjnType) emer.Prjn
- func (nt *Network) ConnectLayersPrjn(send, recv emer.Layer, pat prjn.Pattern, typ emer.PrjnType, pj emer.Prjn) emer.Prjn
- func (nt *Network) Defaults()
- func (nt *Network) InitName(net emer.Network, name string)
- func (nt *Network) Label() string
- func (nt *Network) LateralConnectLayer(lay emer.Layer, pat prjn.Pattern) emer.Prjn
- func (nt *Network) LateralConnectLayerPrjn(lay emer.Layer, pat prjn.Pattern, pj emer.Prjn) emer.Prjn
- func (nt *Network) Layer(idx int) emer.Layer
- func (nt *Network) LayerByName(name string) emer.Layer
- func (nt *Network) LayerByNameTry(name string) (emer.Layer, error)
- func (nt *Network) LayersByClass(classes ...string) []string
- func (nt *Network) Layout()
- func (nt *Network) MakeLayMap()
- func (nt *Network) NLayers() int
- func (nt *Network) Name() string
- func (nt *Network) NewLayer() emer.Layer
- func (nt *Network) NewPrjn() emer.Prjn
- func (nt *Network) NonDefaultParams() string
- func (nt *Network) OpenWtsJSON(filename gi.FileName) error
- func (nt *Network) ReadWtsJSON(r io.Reader) error
- func (nt *Network) SaveWtsJSON(filename gi.FileName) error
- func (nt *Network) SetWts(nw *weights.Network) error
- func (nt *Network) StdVertLayout()
- func (nt *Network) SynVarNames() []string
- func (nt *Network) SynVarProps() map[string]string
- func (nt *Network) UnitVarNames() []string
- func (nt *Network) UnitVarProps() map[string]string
- func (nt *Network) UpdateParams()
- func (nt *Network) VarRange(varNm string) (min, max float32, err error)
- func (nt *Network) WriteWtsJSON(w io.Writer) error
- type Prjn
- func (pj *Prjn) AddVar(varNm string)
- func (pj *Prjn) AddVars(varNms []string)
- func (pj *Prjn) AddWtDWtVars()
- func (pj *Prjn) AllParams() string
- func (pj *Prjn) ApplyParams(pars *params.Sheet, setMsg bool) (bool, error)
- func (pj *Prjn) Build() error
- func (pj *Prjn) BuildStru() error
- func (pj *Prjn) BuildVarNames()
- func (pj *Prjn) Class() string
- func (pj *Prjn) Connect(slay, rlay emer.Layer, pat prjn.Pattern, typ emer.PrjnType)
- func (pj *Prjn) Defaults()
- func (pj *Prjn) Init(prjn emer.Prjn)
- func (pj *Prjn) IsOff() bool
- func (pj *Prjn) Label() string
- func (pj *Prjn) Name() string
- func (pj *Prjn) NonDefaultParams() string
- func (pj *Prjn) Pattern() prjn.Pattern
- func (pj *Prjn) PrjnTypeName() string
- func (pj *Prjn) ReadWtsJSON(r io.Reader) error
- func (pj *Prjn) RecvLay() emer.Layer
- func (pj *Prjn) SendLay() emer.Layer
- func (pj *Prjn) SetClass(cls string) emer.Prjn
- func (pj *Prjn) SetNIdxSt(n *[]int32, avgmax *minmax.AvgMax32, idxst *[]int32, tn *etensor.Int32) int32
- func (pj *Prjn) SetOff(off bool)
- func (pj *Prjn) SetPattern(pat prjn.Pattern) emer.Prjn
- func (pj *Prjn) SetSynVal(varNm string, sidx, ridx int, val float32) error
- func (pj *Prjn) SetType(typ emer.PrjnType) emer.Prjn
- func (pj *Prjn) SetWts(pw *weights.Prjn) error
- func (pj *Prjn) String() string
- func (pj *Prjn) SynIdx(sidx, ridx int) int
- func (pj *Prjn) SynVal(varNm string, sidx, ridx int) float32
- func (pj *Prjn) SynVal1D(varIdx int, synIdx int) float32
- func (pj *Prjn) SynVals(vals *[]float32, varNm string) error
- func (pj *Prjn) SynVarIdx(varNm string) (int, error)
- func (pj *Prjn) SynVarNames() []string
- func (pj *Prjn) SynVarNum() int
- func (pj *Prjn) SynVarProps() map[string]string
- func (pj *Prjn) Type() emer.PrjnType
- func (pj *Prjn) TypeName() string
- func (pj *Prjn) UpdateParams()
- func (pj *Prjn) Validate(logmsg bool) error
- func (pj *Prjn) WriteWtsJSON(w io.Writer, depth int)
Constants ¶
const ( Version = "v1.0.10" GitCommit = "75bc2af" // the commit JUST BEFORE the release VersionDate = "2022-02-15 13:06" // UTC )
Variables ¶
This section is empty.
Functions ¶
func JsonToParams ¶
JsonToParams reformates json output to suitable params display output
Types ¶
type Layer ¶
type Layer struct { Network emer.Network `` /* 141-byte string literal not displayed */ Nm string `` /* 151-byte string literal not displayed */ Cls string `desc:"Class is for applying parameter styles, can be space separated multple tags"` Off bool `desc:"inactivate this layer -- allows for easy experimentation"` Shp etensor.Shape `` /* 219-byte string literal not displayed */ Typ emer.LayerType `` /* 161-byte string literal not displayed */ Thr int `` /* 216-byte string literal not displayed */ Rel relpos.Rel `view:"inline" desc:"Spatial relationship to other layer, determines positioning"` Ps mat32.Vec3 `` /* 154-byte string literal not displayed */ Idx int `desc:"a 0..n-1 index of the position of the layer within list of layers in the network."` RcvPrjns emer.Prjns `desc:"list of receiving projections into this layer from other layers"` SndPrjns emer.Prjns `desc:"list of sending projections from this layer to other layers"` States map[string]*etensor.Float32 `desc:"map of states of the layer (activation, etc) -- name is variable name, tensor holds the data"` VarNamesMap map[string]int `view:"-" desc:"map of variable names with index into the VarNames list"` VarNames []string `view:"-" desc:"list of variable names alpha order"` }
etorch.Layer manages the structural elements of the layer, which are common to any Layer type
func (*Layer) AddNetinActBiasVars ¶
func (ly *Layer) AddNetinActBiasVars()
AddNetinActBiasVars adds standard Netin, Act, Bias variables
func (*Layer) AddVar ¶
AddVar adds a variable to record in this layer. Each variable is recorded in a separate etensor.Float32, which is updated in python from torch tensors.
func (*Layer) AddVars ¶
AddVars adds variables to record in this layer. Each variable is recorded in a separate etensor.Float32, which is updated in python from torch tensors.
func (*Layer) ApplyParams ¶
ApplyParams applies given parameter style Sheet to this layer and its recv projections. Calls UpdateParams on anything set to ensure derived parameters are all updated. If setMsg is true, then a message is printed to confirm each parameter that is set. it always prints a message if a parameter fails to be set. returns true if any params were set, and error if there were any errors.
func (*Layer) BuildPrjns ¶
BuildPrjns builds the projections, recv-side
func (*Layer) BuildVarNames ¶
func (ly *Layer) BuildVarNames()
BuildVarNames makes the var names from VarNamesMap added previously
func (*Layer) InitName ¶
InitName MUST be called to initialize the layer's pointer to itself as an emer.Layer which enables the proper interface methods to be called. Also sets the name, and the parent network that this layer belongs to (which layers may want to retain).
func (*Layer) NPools ¶
NPools returns the number of unit sub-pools according to the shape parameters. Currently supported for a 4D shape, where the unit pools are the first 2 Y,X dims and then the units within the pools are the 2nd 2 Y,X dims
func (*Layer) NRecvPrjns ¶
func (*Layer) NSendPrjns ¶
func (*Layer) NonDefaultParams ¶
NonDefaultParams returns a listing of all parameters in the Layer that are not at their default values -- useful for setting param styles etc.
func (*Layer) ReadWtsJSON ¶
ReadWtsJSON reads the weights from this layer from the receiver-side perspective in a JSON text format. This is for a set of weights that were saved *for one layer only* and is not used for the network-level ReadWtsJSON, which reads into a separate structure -- see SetWts method.
func (*Layer) RecipToSendPrjn ¶
RecipToSendPrjn finds the reciprocal projection relative to the given sending projection found within the SendPrjns of this layer. This is then a recv prjn within this layer:
S=A -> R=B recip: R=A <- S=B -- ly = A -- we are the sender of srj and recv of rpj.
returns false if not found.
func (*Layer) RecvPrjnVals ¶
func (ly *Layer) RecvPrjnVals(vals *[]float32, varNm string, sendLay emer.Layer, sendIdx1D int, prjnType string) error
RecvPrjnVals fills in values of given synapse variable name, for projection into given sending layer and neuron 1D index, for all receiving neurons in this layer, into given float32 slice (only resized if not big enough). prjnType is the string representation of the prjn type -- used if non-empty, useful when there are multiple projections between two layers. Returns error on invalid var name. If the receiving neuron is not connected to the given sending layer or neuron then the value is set to mat32.NaN(). Returns error on invalid var name or lack of recv prjn (vals always set to nan on prjn err).
func (*Layer) SendPrjnVals ¶
func (ly *Layer) SendPrjnVals(vals *[]float32, varNm string, recvLay emer.Layer, recvIdx1D int, prjnType string) error
SendPrjnVals fills in values of given synapse variable name, for projection into given receiving layer and neuron 1D index, for all sending neurons in this layer, into given float32 slice (only resized if not big enough). prjnType is the string representation of the prjn type -- used if non-empty, useful when there are multiple projections between two layers. Returns error on invalid var name. If the sending neuron is not connected to the given receiving layer or neuron then the value is set to mat32.NaN(). Returns error on invalid var name or lack of recv prjn (vals always set to nan on prjn err).
func (*Layer) UnitVal ¶
UnitVal returns value of given variable name on given unit, using shape-based dimensional index
func (*Layer) UnitVal1D ¶
UnitVal1D returns value of given variable index on given unit, using 1-dimensional index. returns NaN on invalid index. This is the core unit var access method used by other methods, so it is the only one that needs to be updated for derived layer types.
func (*Layer) UnitVals ¶
UnitVals fills in values of given variable name on unit, for each unit in the layer, into given float32 slice (only resized if not big enough). Returns error on invalid var name.
func (*Layer) UnitValsTensor ¶
UnitValsTensor returns values of given variable name on unit for each unit in the layer, as a float32 tensor in same shape as layer units.
func (*Layer) UnitVarIdx ¶
UnitVarIdx returns the index of given variable within the Neuron, according to *this layer's* UnitVarNames() list (using a map to lookup index), or -1 and error message if not found.
func (*Layer) UnitVarNames ¶
UnitVarNames returns a list of variable names available on the units in this layer
func (*Layer) UnitVarNum ¶
UnitVarNum returns the number of Neuron-level variables for this layer. This is needed for extending indexes in derived types.
func (*Layer) UnitVarProps ¶
UnitVarProps returns properties for variables
func (*Layer) UpdateParams ¶
func (ly *Layer) UpdateParams()
UpdateParams updates all params given any changes that might have been made to individual values including those in the receiving projections of this layer
type Network ¶
type Network struct { EmerNet emer.Network `` /* 274-byte string literal not displayed */ Nm string `desc:"overall name of network -- helps discriminate if there are multiple"` Layers emer.Layers `desc:"list of layers"` LayMap map[string]emer.Layer `view:"-" desc:"map of name to layers -- layer names must be unique"` LayClassMap map[string][]string `view:"-" desc:"map of layer classes -- made during Build"` MinPos mat32.Vec3 `view:"-" desc:"minimum display position in network"` MaxPos mat32.Vec3 `view:"-" desc:"maximum display position in network"` MetaData map[string]string `` /* 194-byte string literal not displayed */ LayVarNamesMap map[string]int `view:"-" desc:"map of variable names accumulated across layers, with index into the LayVarNames list"` LayVarNames []string `view:"-" desc:"list of variable names accumulated across layers, alpha order"` PrjnVarNamesMap map[string]int `view:"-" desc:"map of variable names accumulated across prjns, with index into the LayVarNames list"` PrjnVarNames []string `view:"-" desc:"list of variable names accumulated across prjns, alpha order"` }
etorch.Network holds the layers of the network
func (*Network) AddLayer ¶
AddLayer adds a new layer with given name and shape to the network. 2D and 4D layer shapes are generally preferred but not essential -- see AddLayer2D and 4D for convenience methods for those. 4D layers enable pool (unit-group) level inhibition in Etorch networks, for example. shape is in row-major format with outer-most dimensions first: e.g., 4D 3, 2, 4, 5 = 3 rows (Y) of 2 cols (X) of pools, with each unit group having 4 rows (Y) of 5 (X) units.
func (*Network) AddLayer2D ¶
AddLayer2D adds a new layer with given name and 2D shape to the network. 2D and 4D layer shapes are generally preferred but not essential.
func (*Network) AddLayer4D ¶
func (nt *Network) AddLayer4D(name string, nPoolsY, nPoolsX, nNeurY, nNeurX int, typ emer.LayerType) emer.Layer
AddLayer4D adds a new layer with given name and 4D shape to the network. 4D layers enable pool (unit-group) level inhibition in Etorch networks, for example. shape is in row-major format with outer-most dimensions first: e.g., 4D 3, 2, 4, 5 = 3 rows (Y) of 2 cols (X) of pools, with each pool having 4 rows (Y) of 5 (X) neurons.
func (*Network) AddLayerInit ¶
AddLayerInit is implementation routine that takes a given layer and adds it to the network, and initializes and configures it properly.
func (*Network) ApplyParams ¶
ApplyParams applies given parameter style Sheet to layers and prjns in this network. Calls UpdateParams to ensure derived parameters are all updated. If setMsg is true, then a message is printed to confirm each parameter that is set. it always prints a message if a parameter fails to be set. returns true if any params were set, and error if there were any errors.
func (*Network) BidirConnectLayerNames ¶
func (nt *Network) BidirConnectLayerNames(low, high string, pat prjn.Pattern) (lowlay, highlay emer.Layer, fwdpj, backpj emer.Prjn, err error)
BidirConnectLayerNames establishes bidirectional projections between two layers, referenced by name, with low = the lower layer that sends a Forward projection to the high layer, and receives a Back projection in the opposite direction. Returns error if not successful. Does not yet actually connect the units within the layers -- that requires Build.
func (*Network) BidirConnectLayers ¶
func (nt *Network) BidirConnectLayers(low, high emer.Layer, pat prjn.Pattern) (fwdpj, backpj emer.Prjn)
BidirConnectLayers establishes bidirectional projections between two layers, with low = lower layer that sends a Forward projection to the high layer, and receives a Back projection in the opposite direction. Does not yet actually connect the units within the layers -- that requires Build.
func (*Network) BidirConnectLayersPy ¶
BidirConnectLayersPy establishes bidirectional projections between two layers, with low = lower layer that sends a Forward projection to the high layer, and receives a Back projection in the opposite direction. Does not yet actually connect the units within the layers -- that requires Build. Py = python version with no return vals.
func (*Network) BoundsUpdt ¶
func (nt *Network) BoundsUpdt()
BoundsUpdt updates the Min / Max display bounds for 3D display
func (*Network) Build ¶
Build constructs the layer and projection state based on the layer shapes and patterns of interconnectivity
func (*Network) BuildVarNames ¶
func (nt *Network) BuildVarNames()
BuildVarNames makes the var names from states of network
func (*Network) ConnectLayerNames ¶
func (nt *Network) ConnectLayerNames(send, recv string, pat prjn.Pattern, typ emer.PrjnType) (rlay, slay emer.Layer, pj emer.Prjn, err error)
ConnectLayerNames establishes a projection between two layers, referenced by name adding to the recv and send projection lists on each side of the connection. Returns error if not successful. Does not yet actually connect the units within the layers -- that requires Build.
func (*Network) ConnectLayers ¶
func (nt *Network) ConnectLayers(send, recv emer.Layer, pat prjn.Pattern, typ emer.PrjnType) emer.Prjn
ConnectLayers establishes a projection between two layers, adding to the recv and send projection lists on each side of the connection. Does not yet actually connect the units within the layers -- that requires Build.
func (*Network) ConnectLayersPrjn ¶
func (nt *Network) ConnectLayersPrjn(send, recv emer.Layer, pat prjn.Pattern, typ emer.PrjnType, pj emer.Prjn) emer.Prjn
ConnectLayersPrjn makes connection using given projection between two layers, adding given prjn to the recv and send projection lists on each side of the connection. Does not yet actually connect the units within the layers -- that requires Build.
func (*Network) Defaults ¶
func (nt *Network) Defaults()
Defaults sets all the default parameters for all layers and projections
func (*Network) InitName ¶
InitName MUST be called to initialize the network's pointer to itself as an emer.Network which enables the proper interface methods to be called. Also sets the name.
func (*Network) LateralConnectLayer ¶
LateralConnectLayer establishes a self-projection within given layer. Does not yet actually connect the units within the layers -- that requires Build.
func (*Network) LateralConnectLayerPrjn ¶
func (nt *Network) LateralConnectLayerPrjn(lay emer.Layer, pat prjn.Pattern, pj emer.Prjn) emer.Prjn
LateralConnectLayerPrjn makes lateral self-projection using given projection. Does not yet actually connect the units within the layers -- that requires Build.
func (*Network) LayerByName ¶
LayerByName returns a layer by looking it up by name in the layer map (nil if not found). Will create the layer map if it is nil or a different size than layers slice, but otherwise needs to be updated manually.
func (*Network) LayerByNameTry ¶
LayerByNameTry returns a layer by looking it up by name -- emits a log error message if layer is not found
func (*Network) LayersByClass ¶ added in v1.0.10
LayersByClass returns a list of layer names by given class(es). Lists are compiled when network Build() function called. The layer Type is always included as a Class, along with any other space-separated strings specified in Class for parameter styling, etc. If no classes are passed, all layer names in order are returned.
func (*Network) Layout ¶
func (nt *Network) Layout()
Layout computes the 3D layout of layers based on their relative position settings
func (*Network) MakeLayMap ¶
func (nt *Network) MakeLayMap()
MakeLayMap updates layer map based on current layers
func (*Network) NonDefaultParams ¶
NonDefaultParams returns a listing of all parameters in the Network that are not at their default values -- useful for setting param styles etc.
func (*Network) OpenWtsJSON ¶
OpenWtsJSON opens network weights (and any other state that adapts with learning) from a JSON-formatted file. If filename has .gz extension, then file is gzip uncompressed.
func (*Network) ReadWtsJSON ¶
ReadWtsJSON reads network weights (and any other state that adapts with learning) from JSON-formatted input. Reads into a temporary weights.Network structure that is then passed to SetWts to actually set the weights.
func (*Network) SaveWtsJSON ¶
SaveWtsJSON saves network weights (and any other state that adapts with learning) to a JSON-formatted file. If filename has .gz extension, then file is gzip compressed.
func (*Network) SetWts ¶
SetWts sets the weights for this network from weights.Network decoded values
func (*Network) StdVertLayout ¶
func (nt *Network) StdVertLayout()
StdVertLayout arranges layers in a standard vertical (z axis stack) layout, by setting the Rel settings
func (*Network) SynVarNames ¶
SynVarNames returns the names of all the variables on the synapses in this network. Not all projections need to support all variables, but must safely return 0's for unsupported ones. The order of this list determines NetView variable display order. This is typically a global list so do not modify!
func (*Network) SynVarProps ¶
SynVarProps returns properties for variables
func (*Network) UnitVarNames ¶
UnitVarNames returns a list of variable names available on the units in this network. Not all layers need to support all variables, but must safely return 0's for unsupported ones. The order of this list determines NetView variable display order. This is typically a global list so do not modify!
func (*Network) UnitVarProps ¶
UnitVarProps returns properties for variables
func (*Network) UpdateParams ¶
func (nt *Network) UpdateParams()
UpdateParams updates all the derived parameters if any have changed, for all layers and projections
type Prjn ¶
type Prjn struct { Off bool `desc:"inactivate this projection -- allows for easy experimentation"` Cls string `desc:"Class is for applying parameter styles, can be space separated multple tags"` Notes string `desc:"can record notes about this projection here"` Send emer.Layer `desc:"sending layer for this projection"` Recv emer.Layer `` /* 169-byte string literal not displayed */ Pat prjn.Pattern `desc:"pattern of connectivity"` Typ emer.PrjnType `` /* 154-byte string literal not displayed */ RConN []int32 `view:"-" desc:"number of recv connections for each neuron in the receiving layer, as a flat list"` RConNAvgMax minmax.AvgMax32 `inactive:"+" desc:"average and maximum number of recv connections in the receiving layer"` RConIdxSt []int32 `view:"-" desc:"starting index into ConIdx list for each neuron in receiving layer -- just a list incremented by ConN"` RConIdx []int32 `` /* 213-byte string literal not displayed */ SSynIdx []int32 `` /* 182-byte string literal not displayed */ SConN []int32 `view:"-" desc:"number of sending connections for each neuron in the sending layer, as a flat list"` SConNAvgMax minmax.AvgMax32 `inactive:"+" desc:"average and maximum number of sending connections in the sending layer"` SConIdxSt []int32 `view:"-" desc:"starting index into ConIdx list for each neuron in sending layer -- just a list incremented by ConN"` SConIdx []int32 `` /* 213-byte string literal not displayed */ States map[string]*etensor.Float32 `desc:"map of states of the projection (weights, etc) -- name is variable name, tensor holds the data"` VarNamesMap map[string]int `view:"-" desc:"map of variable names with index into the VarNames list"` VarNames []string `view:"-" desc:"list of variable names alpha order"` }
Prjn contains the basic structural information for specifying a projection of synaptic connections between two layers, and maintaining all the synaptic connection-level data. The exact same struct object is added to the Recv and Send layers, and it manages everything about the connectivity, and methods on the Prjn handle all the relevant computation.
func (*Prjn) AddVar ¶
AddVar adds a variable to record in this layer. Each variable is recorded in a separate etensor.Float32, which is updated in python from torch tensors.
func (*Prjn) AddVars ¶
AddVars adds variables to record in this layer. Each variable is recorded in a separate etensor.Float32, which is updated in python from torch tensors.
func (*Prjn) AddWtDWtVars ¶
func (pj *Prjn) AddWtDWtVars()
AddWtDWtVars adds standard Wt, DWt variables
func (*Prjn) ApplyParams ¶
ApplyParams applies given parameter style Sheet to this projection. Calls UpdateParams if anything set to ensure derived parameters are all updated. If setMsg is true, then a message is printed to confirm each parameter that is set. it always prints a message if a parameter fails to be set. returns true if any params were set, and error if there were any errors.
func (*Prjn) Build ¶
Build constructs the full connectivity among the layers as specified in this projection. Calls PrjnStru.BuildStru and then allocates the synaptic values in Syns accordingly.
func (*Prjn) BuildStru ¶
BuildStru constructs the full connectivity among the layers as specified in this projection. Calls Validate and returns false if invalid. Pat.Connect is called to get the pattern of the connection. Then the connection indexes are configured according to that pattern.
func (*Prjn) BuildVarNames ¶
func (pj *Prjn) BuildVarNames()
BuildVarNames makes the var names from VarNamesMap added previously
func (*Prjn) Connect ¶
Connect sets the connectivity between two layers and the pattern to use in interconnecting them
func (*Prjn) Init ¶
Init MUST be called to initialize the prjn's pointer to itself as an emer.Prjn which enables the proper interface methods to be called.
func (*Prjn) NonDefaultParams ¶
NonDefaultParams returns a listing of all parameters in the Layer that are not at their default values -- useful for setting param styles etc.
func (*Prjn) PrjnTypeName ¶
func (*Prjn) ReadWtsJSON ¶
ReadWtsJSON reads the weights from this projection from the receiver-side perspective in a JSON text format. This is for a set of weights that were saved *for one prjn only* and is not used for the network-level ReadWtsJSON, which reads into a separate structure -- see SetWts method.
func (*Prjn) SetNIdxSt ¶
func (pj *Prjn) SetNIdxSt(n *[]int32, avgmax *minmax.AvgMax32, idxst *[]int32, tn *etensor.Int32) int32
SetNIdxSt sets the *ConN and *ConIdxSt values given n tensor from Pat. Returns total number of connections for this direction.
func (*Prjn) SetSynVal ¶
SetSynVal sets value of given variable name on the synapse between given send, recv unit indexes (1D, flat indexes) returns error for access errors.
func (*Prjn) SynIdx ¶
SynIdx returns the index of the synapse between given send, recv unit indexes (1D, flat indexes). Returns -1 if synapse not found between these two neurons. Requires searching within connections for sending unit.
func (*Prjn) SynVal ¶
SynVal returns value of given variable name on the synapse between given send, recv unit indexes (1D, flat indexes). Returns mat32.NaN() for access errors (see SynValTry for error message)
func (*Prjn) SynVal1D ¶
SynVal1D returns value of given variable index (from SynVarIdx) on given SynIdx. Returns NaN on invalid index. This is the core synapse var access method used by other methods, so it is the only one that needs to be updated for derived layer types.
func (*Prjn) SynVals ¶
SynVals sets values of given variable name for each synapse, using the natural ordering of the synapses (recv based) into given float32 slice (only resized if not big enough). Returns error on invalid var name.
func (*Prjn) SynVarIdx ¶
SynVarIdx returns the index of given variable within the synapse, according to *this prjn's* SynVarNames() list (using a map to lookup index), or -1 and error message if not found.
func (*Prjn) SynVarNames ¶
func (*Prjn) SynVarNum ¶
SynVarNum returns the number of synapse-level variables for this prjn. This is needed for extending indexes in derived types.
func (*Prjn) SynVarProps ¶
SynVarProps returns properties for variables
func (*Prjn) UpdateParams ¶
func (pj *Prjn) UpdateParams()
UpdateParams updates all params given any changes that might have been made to individual values