diff --git a/chem/typegen.go b/chem/typegen.go index c301f2be..940a7dc1 100644 --- a/chem/typegen.go +++ b/chem/typegen.go @@ -14,10 +14,10 @@ var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/chem.Enz", var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/chem.EnzRate", IDName: "enz-rate", Doc: "EnzRate models an enzyme-catalyzed reaction based on the Michaelis-Menten kinetics\nthat transforms S = substrate into P product via SE bound C complex\n\n\tK1 K3\n\nS + E --> C(SE) ---> P + E\n\n\t<-- K2\n\nS = substrate, E = enzyme, C = SE complex, P = product\nThis version does NOT consume the E enzyme or directly use the C complex\nas an accumulated factor: instead it directly computes an overall rate\nfor the end-to-end S <-> P reaction based on the K constants:\nrate = S * E * K3 / (S + Km)\nThis amount is added to the P and subtracted from the S, and recorded\nin the C complex variable as rate / K3 -- it is just directly set.\nIn some situations this C variable can be used for other things.\nThe source K constants are in terms of concentrations μM-1 and sec-1\nbut calculations take place using N's, and the forward direction has\ntwo factors while reverse only has one, so a corrective volume factor needs\nto be divided out to set the actual forward factor.", Fields: []types.Field{{Name: "K1", Doc: "S+E forward rate constant, in μM-1 msec-1"}, {Name: "K2", Doc: "SE backward rate constant, in μM-1 msec-1"}, {Name: "K3", Doc: "SE -> P + E catalyzed rate constant, in μM-1 msec-1"}, {Name: "Km", Doc: "Michaelis constant = (K2 + K3) / K1 -- goes into the rate"}}}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/chem.Paramer", IDName: "paramer", Doc: "The Paramer interface defines functions implemented for Params\nstructures, containing chem React, Enz, etc functions.\nThis interface is largely for documentation purposes."}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/chem.Paramer", IDName: "paramer", Doc: "The Paramer interface defines functions implemented for Params\nstructures, containing chem React, Enz, etc functions.\nThis interface is largely for documentation purposes.", Methods: []types.Method{{Name: "Defaults", Doc: "Defaults sets default parameters"}, {Name: "Step", Doc: "Step computes deltas d based on current values c", Args: []string{"c", "d"}}}}) var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/chem.React", IDName: "react", Doc: "React models a basic chemical reaction:\n\n\tKf\n\nA + B --> AB\n\n\t<-- Kb\n\nwhere Kf is the forward and Kb is the backward time constant.\nThe source Kf and Kb constants are in terms of concentrations μM-1 and sec-1\nbut calculations take place using N's, and the forward direction has\ntwo factors while reverse only has one, so a corrective volume factor needs\nto be divided out to set the actual forward factor.", Directives: []types.Directive{{Tool: "go", Directive: "generate", Args: []string{"core", "generate", "-add-types"}}}, Fields: []types.Field{{Name: "Kf", Doc: "forward rate constant for N / sec assuming 2 forward factors"}, {Name: "Kb", Doc: "backward rate constant for N / sec assuming 1 backward factor"}}}) var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/chem.SimpleEnz", IDName: "simple-enz", Doc: "SimpleEnz models a simple enzyme-catalyzed reaction\nthat transforms S = substrate into P product via E which is not consumed\nassuming there is much more E than S and P -- E effectively acts as a\nrate constant multiplier\n\n\tKf*E\n\nS ----> P\n\nS = substrate, E = enzyme, P = product, Kf is the rate of the reaction", Fields: []types.Field{{Name: "Kf", Doc: "S->P forward rate constant, in μM-1 msec-1"}}}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/chem.Stater", IDName: "stater", Doc: "The Stater interface defines the functions implemented for State\nstructures containing chem state variables.\nThis interface is largely for documentation purposes."}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/chem.Stater", IDName: "stater", Doc: "The Stater interface defines the functions implemented for State\nstructures containing chem state variables.\nThis interface is largely for documentation purposes.", Methods: []types.Method{{Name: "Init", Doc: "Init Initializes the state to starting default values (concentrations)"}, {Name: "Zero", Doc: "Zero sets all state variables to zero -- called for deltas after integration"}, {Name: "Integrate", Doc: "Integrate is called with the deltas -- each state value calls Integrate()\nto update from deltas.", Args: []string{"d"}}, {Name: "Log", Doc: "Log records relevant state variables in given table at given row", Args: []string{"dt", "row"}}, {Name: "ConfigLog", Doc: "ConfigLog configures the table to add column(s) for what is logged", Args: []string{"dt"}}}}) diff --git a/decoder/typegen.go b/decoder/typegen.go index 5b0342b5..137ae8c2 100644 --- a/decoder/typegen.go +++ b/decoder/typegen.go @@ -10,7 +10,7 @@ var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/decoder.Act var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/decoder.Linear", IDName: "linear", Doc: "Linear is a linear neural network, which can be configured with a custom\nactivation function. By default it will use the identity function.\nIt learns using the delta rule for each output unit.", Fields: []types.Field{{Name: "LRate", Doc: "learning rate"}, {Name: "Layers", Doc: "layers to decode"}, {Name: "Units", Doc: "unit values -- read this for decoded output"}, {Name: "NInputs", Doc: "number of inputs -- total sizes of layer inputs"}, {Name: "NOutputs", Doc: "number of outputs -- total sizes of layer inputs"}, {Name: "Inputs", Doc: "input values, copied from layers"}, {Name: "ValuesTsrs", Doc: "for holding layer values"}, {Name: "Weights", Doc: "synaptic weights: outer loop is units, inner loop is inputs"}, {Name: "ActivationFn", Doc: "activation function"}, {Name: "PoolIndex", Doc: "which pool to use within a layer"}, {Name: "Comm", Doc: "mpi communicator -- MPI users must set this to their comm -- do direct assignment"}, {Name: "MPIDWts", Doc: "delta weight changes: only for MPI mode -- outer loop is units, inner loop is inputs"}}}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/decoder.Layer", IDName: "layer", Doc: "Layer is the subset of emer.Layer that is used by this code"}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/decoder.Layer", IDName: "layer", Doc: "Layer is the subset of emer.Layer that is used by this code", Methods: []types.Method{{Name: "Name", Returns: []string{"string"}}, {Name: "UnitValuesTensor", Args: []string{"tsr", "varNm", "di"}, Returns: []string{"error"}}, {Name: "Shape", Returns: []string{"Shape"}}}}) var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/decoder.LinearUnit", IDName: "linear-unit", Doc: "LinearUnit has variables for Linear decoder unit", Fields: []types.Field{{Name: "Target", Doc: "target activation value -- typically 0 or 1 but can be within that range too"}, {Name: "Act", Doc: "final activation = sum x * w -- this is the decoded output"}, {Name: "Net", Doc: "net input = sum x * w"}}}) diff --git a/econfig/typegen.go b/econfig/typegen.go index c38bc3d8..4767aa0b 100644 --- a/econfig/typegen.go +++ b/econfig/typegen.go @@ -8,6 +8,6 @@ import ( var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/econfig.TestEnum", IDName: "test-enum", Doc: "TestEnum is an enum type for testing"}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/econfig.Includeser", IDName: "includeser", Doc: "Includeser enables processing of Includes []string field with files to include in Config objects."}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/econfig.Includeser", IDName: "includeser", Doc: "Includeser enables processing of Includes []string field with files to include in Config objects.", Methods: []types.Method{{Name: "IncludesPtr", Doc: "IncludesPtr returns a pointer to the Includes []string field containing file(s) to include\nbefore processing the current config file.", Returns: []string{"*"}}}}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/econfig.Includer", IDName: "includer", Doc: "Includer enables processing of Include string field with file to include in Config objects."}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/econfig.Includer", IDName: "includer", Doc: "Includer enables processing of Include string field with file to include in Config objects.", Methods: []types.Method{{Name: "IncludePtr", Doc: "IncludePtr returns a pointer to the Include string field containing single file to include\nbefore processing the current config file.", Returns: []string{"*string"}}}}) diff --git a/emer/typegen.go b/emer/typegen.go index b9c7db1f..e28c56b8 100644 --- a/emer/typegen.go +++ b/emer/typegen.go @@ -6,7 +6,7 @@ import ( "cogentcore.org/core/types" ) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/emer.Layer", IDName: "layer", Doc: "Layer defines the basic interface for neural network layers, used for managing the structural\nelements of a network, and for visualization, I/O, etc.\nInterfaces are automatically pointers -- think of this as a pointer to your specific layer\ntype, with a very basic interface for accessing general structural properties. Nothing\nalgorithm-specific is implemented here -- all of that goes in your specific layer struct."}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/emer.Layer", IDName: "layer", Doc: "Layer defines the basic interface for neural network layers, used for managing the structural\nelements of a network, and for visualization, I/O, etc.\nInterfaces are automatically pointers -- think of this as a pointer to your specific layer\ntype, with a very basic interface for accessing general structural properties. Nothing\nalgorithm-specific is implemented here -- all of that goes in your specific layer struct.", Methods: []types.Method{{Name: "InitName", Doc: "InitName MUST be called to initialize the layer's pointer to itself as an emer.Layer\nwhich enables the proper interface methods to be called. Also sets the name, and\nthe parent network that this layer belongs to (which layers may want to retain).", Args: []string{"lay", "name", "net"}}, {Name: "Label", Doc: "Label satisfies the core.Labeler interface for getting the name of objects generically", Returns: []string{"string"}}, {Name: "SetName", Doc: "SetName sets name of layer", Args: []string{"nm"}}, {Name: "AddClass", Doc: "AddClass adds a CSS-style class name(s) for this layer,\nensuring that it is not a duplicate, and properly space separated.\nReturns Layer so it can be chained to set other properties too", Args: []string{"cls"}, Returns: []string{"Layer"}}, {Name: "IsOff", Doc: "IsOff returns true if layer has been turned Off (lesioned) -- for experimentation", Returns: []string{"bool"}}, {Name: "SetOff", Doc: "SetOff sets the \"off\" (lesioned) status of layer. Also sets the Off state of all\npathways from this layer to other layers.", Args: []string{"off"}}, {Name: "Shape", Doc: "Shape returns the organization of units in the layer, in terms of an array of dimensions.\nRow-major ordering is default (Y then X), outer-most to inner-most.\nif 2D, then it is a simple Y,X layer with no sub-structure (pools).\nIf 4D, then it number of pools Y, X and then number of units per pool Y, X", Returns: []string{"Shape"}}, {Name: "Is2D", Doc: "Is2D() returns true if this is a 2D layer (no Pools)", Returns: []string{"bool"}}, {Name: "Is4D", Doc: "Is4D() returns true if this is a 4D layer (has Pools as inner 2 dimensions)", Returns: []string{"bool"}}, {Name: "Index4DFrom2D", Doc: "Index4DFrom2D returns the 4D index from 2D coordinates\nwithin which inner dims are interleaved. Returns false if 2D coords are invalid.", Args: []string{"x", "y"}, Returns: []string{"[]int", "bool"}}, {Name: "Type", Doc: "Type returns the functional type of layer according to LayerType (extensible in\nmore specialized algorithms)", Returns: []string{"LayerType"}}, {Name: "SetType", Doc: "SetType sets the functional type of layer", Args: []string{"typ"}}, {Name: "Config", Doc: "Config configures the basic parameters of the layer", Args: []string{"shape", "typ"}}, {Name: "RelPos", Doc: "RelPos returns the relative 3D position specification for this layer\nfor display in the 3D NetView -- see Pos() for display conventions.", Returns: []string{"Rel"}}, {Name: "SetRelPos", Doc: "SetRelPos sets the the relative 3D position specification for this layer", Args: []string{"r"}}, {Name: "Pos", Doc: "Pos returns the 3D position of the lower-left-hand corner of the layer.\nThe 3D view has layers arranged in X-Y planes stacked vertically along the Z axis.\nSomewhat confusingly, this differs from the standard 3D graphics convention,\nwhere the vertical dimension is Y and Z is the depth dimension. However, in the\nmore \"layer-centric\" way of thinking about it, it is natural for the width & height\nto map onto X and Y, and then Z is left over for stacking vertically.", Returns: []string{"Vector3"}}, {Name: "SetPos", Doc: "SetPos sets the 3D position of this layer -- will generally be overwritten by\nautomatic RelPos setting, unless that doesn't specify a valid relative position.", Args: []string{"pos"}}, {Name: "Size", Doc: "Size returns the display size of this layer for the 3D view -- see Pos() for general info.\nThis is multiplied by the RelPos.Scale factor to rescale layer sizes, and takes\ninto account 2D and 4D layer structures.", Returns: []string{"Vector2"}}, {Name: "Index", Doc: "Index returns a 0..n-1 index of the position of the layer within list of layers\nin the network. For backprop networks, index position has computational significance.\nFor Leabra networks, it only has significance in determining who gets which weights for\nenforcing initial weight symmetry -- higher layers get weights from lower layers.", Returns: []string{"int"}}, {Name: "SetIndex", Doc: "SetIndex sets the layer index", Args: []string{"idx"}}, {Name: "UnitVarNames", Doc: "UnitVarNames returns a list of variable names available on the units in this layer.\nThis is typically a global list so do not modify!", Returns: []string{"[]string"}}, {Name: "UnitVarProps", Doc: "UnitVarProps returns a map of unit variable properties, with the key being the\nname of the variable, and the value gives a space-separated list of\ngo-tag-style properties for that variable.\nThe NetView recognizes the following properties:\nrange:\"##\" = +- range around 0 for default display scaling\nmin:\"##\" max:\"##\" = min, max display range\nauto-scale:\"+\" or \"-\" = use automatic scaling instead of fixed range or not.\nzeroctr:\"+\" or \"-\" = control whether zero-centering is used\ndesc:\"txt\" tooltip description of the variable\nNote: this is a global list so do not modify!", Returns: []string{"map[string]string"}}, {Name: "UnitVarIndex", Doc: "UnitVarIndex returns the index of given variable within the Neuron,\naccording to *this layer's* UnitVarNames() list (using a map to lookup index),\nor -1 and error message if not found.", Args: []string{"varNm"}, Returns: []string{"int", "error"}}, {Name: "UnitVarNum", Doc: "UnitVarNum returns the number of Neuron-level variables\nfor this layer. This is needed for extending indexes in derived types.", Returns: []string{"int"}}, {Name: "UnitVal1D", Doc: "UnitVal1D returns value of given variable index on given unit,\nusing 1-dimensional index, and a data parallel index di,\nfor networks capable of processing multiple input patterns in parallel.\nreturns NaN on invalid index.\nThis is the core unit var access method used by other methods,\nso it is the only one that needs to be updated for derived layer types.", Args: []string{"varIndex", "idx", "di"}, Returns: []string{"float32"}}, {Name: "UnitValues", Doc: "UnitValues fills in values of given variable name on unit,\nfor each unit in the layer, into given float32 slice (only resized if not big enough).\ndi is a data parallel index di, for networks capable of processing input patterns in parallel.\nReturns error on invalid var name.", Args: []string{"vals", "varNm", "di"}, Returns: []string{"error"}}, {Name: "UnitValuesTensor", Doc: "UnitValuesTensor fills in values of given variable name on unit\nfor each unit in the layer, into given tensor.\ndi is a data parallel index di, for networks capable of processing input patterns in parallel.\nIf tensor is not already big enough to hold the values, it is\nset to the same shape as the layer.\nReturns error on invalid var name.", Args: []string{"tsr", "varNm", "di"}, Returns: []string{"error"}}, {Name: "UnitValuesRepTensor", Doc: "UnitValuesRepTensor fills in values of given variable name on unit\nfor a smaller subset of representative units in the layer, into given tensor.\ndi is a data parallel index di, for networks capable of processing input patterns in parallel.\nThis is used for computationally intensive stats or displays that work\nmuch better with a smaller number of units.\nThe set of representative units are defined by SetRepIndexes -- all units\nare used if no such subset has been defined.\nIf tensor is not already big enough to hold the values, it is\nset to RepShape to hold all the values if subset is defined,\notherwise it calls UnitValuesTensor and is identical to that.\nReturns error on invalid var name.", Args: []string{"tsr", "varNm", "di"}, Returns: []string{"error"}}, {Name: "RepIndexes", Doc: "RepIndexes returns the current set of representative unit indexes.\nwhich are a smaller subset of units that represent the behavior\nof the layer, for computationally intensive statistics and displays\n(e.g., PCA, ActRF, NetView rasters).\nReturns nil if none has been set (in which case all units should be used).\nSee utility function CenterPoolIndexes that returns indexes of\nunits in the central pools of a 4D layer.", Returns: []string{"[]int"}}, {Name: "RepShape", Doc: "RepShape returns the shape to use for the subset of representative\nunit indexes, in terms of an array of dimensions. See Shape() for more info.\nLayers that set RepIndexes should also set this, otherwise a 1D array\nof len RepIndexes will be used.\nSee utility function CenterPoolShape that returns shape of\nunits in the central pools of a 4D layer.", Returns: []string{"Shape"}}, {Name: "SetRepIndexesShape", Doc: "SetRepIndexesShape sets the RepIndexes, and RepShape and as list of dimension sizes", Args: []string{"idxs", "shape"}}, {Name: "UnitValue", Doc: "UnitVal returns value of given variable name on given unit,\nusing shape-based dimensional index.\nReturns NaN on invalid var name or index.\ndi is a data parallel index di, for networks capable of processing input patterns in parallel.", Args: []string{"varNm", "idx", "di"}, Returns: []string{"float32"}}, {Name: "NRecvPaths", Doc: "NRecvPaths returns the number of receiving pathways", Returns: []string{"int"}}, {Name: "RecvPath", Doc: "RecvPath returns a specific receiving pathway", Args: []string{"idx"}, Returns: []string{"Path"}}, {Name: "NSendPaths", Doc: "NSendPaths returns the number of sending pathways", Returns: []string{"int"}}, {Name: "SendPath", Doc: "SendPath returns a specific sending pathway", Args: []string{"idx"}, Returns: []string{"Path"}}, {Name: "SendNameTry", Doc: "SendNameTry looks for a pathway connected to this layer whose sender layer has a given name", Args: []string{"sender"}, Returns: []string{"Path", "error"}}, {Name: "SendNameTypeTry", Doc: "SendNameTypeTry looks for a pathway connected to this layer whose sender layer has a given name and type", Args: []string{"sender", "typ"}, Returns: []string{"Path", "error"}}, {Name: "RecvNameTry", Doc: "RecvNameTry looks for a pathway connected to this layer whose receiver layer has a given name", Args: []string{"recv"}, Returns: []string{"Path", "error"}}, {Name: "RecvNameTypeTry", Doc: "RecvNameTypeTry looks for a pathway connected to this layer whose receiver layer has a given name and type", Args: []string{"recv", "typ"}, Returns: []string{"Path", "error"}}, {Name: "RecvPathValues", Doc: "RecvPathValues fills in values of given synapse variable name,\nfor pathway from given sending layer and neuron 1D index,\nfor all receiving neurons in this layer,\ninto given float32 slice (only resized if not big enough).\npathType is the string representation of the path type -- used if non-empty,\nuseful when there are multiple pathways between two layers.\nReturns error on invalid var name.\nIf the receiving neuron is not connected to the given sending layer or neuron\nthen the value is set to math32.NaN().\nReturns error on invalid var name or lack of recv path (vals always set to nan on path err).", Args: []string{"vals", "varNm", "sendLay", "sendIndex1D", "pathType"}, Returns: []string{"error"}}, {Name: "SendPathValues", Doc: "SendPathValues fills in values of given synapse variable name,\nfor pathway into given receiving layer and neuron 1D index,\nfor all sending neurons in this layer,\ninto given float32 slice (only resized if not big enough).\npathType is the string representation of the path type -- used if non-empty,\nuseful when there are multiple pathways between two layers.\nReturns error on invalid var name.\nIf the sending neuron is not connected to the given receiving layer or neuron\nthen the value is set to math32.NaN().\nReturns error on invalid var name or lack of recv path (vals always set to nan on path err).", Args: []string{"vals", "varNm", "recvLay", "recvIndex1D", "pathType"}, Returns: []string{"error"}}, {Name: "Defaults", Doc: "Defaults sets default parameter values for all Layer and recv pathway parameters"}, {Name: "UpdateParams", Doc: "UpdateParams() updates parameter values for all Layer and recv pathway parameters,\nbased on any other params that might have changed."}, {Name: "ApplyParams", Doc: "ApplyParams applies given parameter style Sheet to this layer and its recv pathways.\nCalls UpdateParams on anything set to ensure derived parameters are all updated.\nIf setMsg is true, then a message is printed to confirm each parameter that is set.\nit always prints a message if a parameter fails to be set.\nreturns true if any params were set, and error if there were any errors.", Args: []string{"pars", "setMsg"}, Returns: []string{"bool", "error"}}, {Name: "SetParam", Doc: "SetParam sets parameter at given path to given value.\nreturns error if path not found or value cannot be set.", Args: []string{"path", "val"}, Returns: []string{"error"}}, {Name: "NonDefaultParams", Doc: "NonDefaultParams returns a listing of all parameters in the Layer that\nare not at their default values -- useful for setting param styles etc.", Returns: []string{"string"}}, {Name: "AllParams", Doc: "AllParams returns a listing of all parameters in the Layer", Returns: []string{"string"}}, {Name: "WriteWtsJSON", Doc: "WriteWtsJSON writes the weights from this layer from the receiver-side perspective\nin a JSON text format. We build in the indentation logic to make it much faster and\nmore efficient.", Args: []string{"w", "depth"}}, {Name: "ReadWtsJSON", Doc: "ReadWtsJSON reads the weights from this layer from the receiver-side perspective\nin a JSON text format. This is for a set of weights that were saved *for one layer only*\nand is not used for the network-level ReadWtsJSON, which reads into a separate\nstructure -- see SetWts method.", Args: []string{"r"}, Returns: []string{"error"}}, {Name: "SetWts", Doc: "SetWts sets the weights for this layer from weights.Layer decoded values", Args: []string{"lw"}, Returns: []string{"error"}}, {Name: "Build", Doc: "Build constructs the layer and pathway state based on the layer shapes\nand patterns of interconnectivity", Returns: []string{"error"}}, {Name: "VarRange", Doc: "VarRange returns the min / max values for given variable\nover the layer", Args: []string{"varNm"}, Returns: []string{"min", "max", "err"}}}}) var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/emer.Layers", IDName: "layers", Doc: "Layers is a slice of layers"}) @@ -20,11 +20,11 @@ var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/emer.LaySiz var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/emer.NetSize", IDName: "net-size", Doc: "NetSize is a network schema for holding a params for layer sizes.\nValues can be queried for getting sizes when configuring the network.\nUses params.Flex to support flexible parameter specification"}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/emer.Network", IDName: "network", Doc: "Network defines the basic interface for a neural network, used for managing the structural\nelements of a network, and for visualization, I/O, etc"}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/emer.Network", IDName: "network", Doc: "Network defines the basic interface for a neural network, used for managing the structural\nelements of a network, and for visualization, I/O, etc", Methods: []types.Method{{Name: "InitName", Doc: "InitName MUST be called to initialize the network's pointer to itself as an emer.Network\nwhich enables the proper interface methods to be called. Also sets the name.", Args: []string{"net", "name"}}, {Name: "Name", Doc: "Name() returns name of the network", Returns: []string{"string"}}, {Name: "Label", Doc: "Label satisfies the core.Labeler interface for getting the name of objects generically", Returns: []string{"string"}}, {Name: "NLayers", Doc: "NLayers returns the number of layers in the network", Returns: []string{"int"}}, {Name: "Layer", Doc: "Layer returns layer (as emer.Layer interface) at given index -- does not\ndo extra bounds checking", Args: []string{"idx"}, Returns: []string{"Layer"}}, {Name: "LayerByName", Doc: "LayerByName returns layer of given name, nil if not found.\nLayer names must be unique and a map is used so this is a fast operation", Args: []string{"name"}, Returns: []string{"Layer"}}, {Name: "LayerByNameTry", Doc: "LayerByNameTry returns layer of given name, returns error if not found.\nLayer names must be unique and a map is used so this is a fast operation", Args: []string{"name"}, Returns: []string{"Layer", "error"}}, {Name: "PathByNameTry", Doc: "PathByNameTry returns path of given name, returns error if not found.\nPath names are SendToRecv, and are looked up by parsing the name", Args: []string{"name"}, Returns: []string{"Path", "error"}}, {Name: "Defaults", Doc: "Defaults sets default parameter values for everything in the Network"}, {Name: "UpdateParams", Doc: "UpdateParams() updates parameter values for all Network parameters,\nbased on any other params that might have changed."}, {Name: "ApplyParams", Doc: "ApplyParams applies given parameter style Sheet to layers and paths in this network.\nCalls UpdateParams on anything set to ensure derived parameters are all updated.\nIf setMsg is true, then a message is printed to confirm each parameter that is set.\nit always prints a message if a parameter fails to be set.\nreturns true if any params were set, and error if there were any errors.", Args: []string{"pars", "setMsg"}, Returns: []string{"bool", "error"}}, {Name: "NonDefaultParams", Doc: "NonDefaultParams returns a listing of all parameters in the Network that\nare not at their default values -- useful for setting param styles etc.", Returns: []string{"string"}}, {Name: "AllParams", Doc: "AllParams returns a listing of all parameters in the Network", Returns: []string{"string"}}, {Name: "KeyLayerParams", Doc: "KeyLayerParams returns a listing for all layers in the network,\nof the most important layer-level params (specific to each algorithm).", Returns: []string{"string"}}, {Name: "KeyPathParams", Doc: "KeyPathParams returns a listing for all Recv pathways in the network,\nof the most important pathway-level params (specific to each algorithm).", Returns: []string{"string"}}, {Name: "UnitVarNames", Doc: "UnitVarNames returns a list of variable names available on the units in this network.\nThis list determines what is shown in the NetView (and the order of vars list).\nNot all layers need to support all variables, but must safely return math32.NaN() for\nunsupported ones.\nThis is typically a global list so do not modify!", Returns: []string{"[]string"}}, {Name: "UnitVarProps", Doc: "UnitVarProps returns a map of unit variable properties, with the key being the\nname of the variable, and the value gives a space-separated list of\ngo-tag-style properties for that variable.\nThe NetView recognizes the following properties:\nrange:\"##\" = +- range around 0 for default display scaling\nmin:\"##\" max:\"##\" = min, max display range\nauto-scale:\"+\" or \"-\" = use automatic scaling instead of fixed range or not.\nzeroctr:\"+\" or \"-\" = control whether zero-centering is used\ndesc:\"txt\" tooltip description of the variable\nNote: this is typically a global list so do not modify!", Returns: []string{"map[string]string"}}, {Name: "SynVarNames", Doc: "SynVarNames returns the names of all the variables on the synapses in this network.\nThis list determines what is shown in the NetView (and the order of vars list).\nNot all pathways need to support all variables, but must safely return math32.NaN() for\nunsupported ones.\nThis is typically a global list so do not modify!", Returns: []string{"[]string"}}, {Name: "SynVarProps", Doc: "SynVarProps returns a map of synapse variable properties, with the key being the\nname of the variable, and the value gives a space-separated list of\ngo-tag-style properties for that variable.\nThe NetView recognizes the following properties:\nrange:\"##\" = +- range around 0 for default display scaling\nmin:\"##\" max:\"##\" = min, max display range\nauto-scale:\"+\" or \"-\" = use automatic scaling instead of fixed range or not.\nzeroctr:\"+\" or \"-\" = control whether zero-centering is used\nNote: this is typically a global list so do not modify!", Returns: []string{"map[string]string"}}, {Name: "WriteWtsJSON", Doc: "WriteWtsJSON writes network weights (and any other state that adapts with learning)\nto JSON-formatted output.", Args: []string{"w"}, Returns: []string{"error"}}, {Name: "ReadWtsJSON", Doc: "ReadWtsJSON reads network weights (and any other state that adapts with learning)\nfrom JSON-formatted input. Reads into a temporary weights.Network structure that\nis then passed to SetWts to actually set the weights.", Args: []string{"r"}, Returns: []string{"error"}}, {Name: "SetWts", Doc: "SetWts sets the weights for this network from weights.Network decoded values", Args: []string{"nw"}, Returns: []string{"error"}}, {Name: "SaveWtsJSON", Doc: "SaveWtsJSON saves network weights (and any other state that adapts with learning)\nto a JSON-formatted file. If filename has .gz extension, then file is gzip compressed.", Args: []string{"filename"}, Returns: []string{"error"}}, {Name: "OpenWtsJSON", Doc: "OpenWtsJSON opens network weights (and any other state that adapts with learning)\nfrom a JSON-formatted file. If filename has .gz extension, then file is gzip uncompressed.", Args: []string{"filename"}, Returns: []string{"error"}}, {Name: "Bounds", Doc: "Bounds returns the minimum and maximum display coordinates of the network for 3D display", Returns: []string{"min", "max"}}, {Name: "VarRange", Doc: "VarRange returns the min / max values for given variable", Args: []string{"varNm"}, Returns: []string{"min", "max", "err"}}, {Name: "LayersByClass", Doc: "LayersByClass returns a list of layer names by given class(es).\nLists are compiled when network Build() function called.\nThe layer Type is always included as a Class, along with any other\nspace-separated strings specified in Class for parameter styling, etc.\nIf no classes are passed, all layer names in order are returned.", Args: []string{"classes"}, Returns: []string{"[]string"}}, {Name: "MaxParallelData", Doc: "MaxParallelData returns the maximum number of data inputs that can be\nprocessed in parallel by the network.\nThe NetView supports display of up to this many data elements.", Returns: []string{"int"}}, {Name: "NParallelData", Doc: "NParallelData returns the current number of data inputs currently being\nprocessed in parallel by the network.\nLogging supports recording each of these where appropriate.", Returns: []string{"int"}}}}) var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/emer.Params", IDName: "params", Doc: "Params handles standard parameters for a Network and other objects.\nAssumes a Set named \"Base\" has the base-level parameters, which are\nalways applied first, followed optionally by additional Set(s)\nthat can have different parameters to try.", Fields: []types.Field{{Name: "Params", Doc: "full collection of param sets to use"}, {Name: "ExtraSets", Doc: "optional additional set(s) of parameters to apply after Base -- can use multiple names separated by spaces (don't put spaces in Set names!)"}, {Name: "Tag", Doc: "optional additional tag to add to file names, logs to identify params / run config"}, {Name: "Objects", Doc: "map of objects to apply parameters to -- the key is the name of the Sheet for each object, e.g.,"}, {Name: "NetHypers", Doc: "list of hyper parameters compiled from the network parameters, using the layers and pathways from the network, so that the same styling logic as for regular parameters can be used"}, {Name: "SetMsg", Doc: "print out messages for each parameter that is set"}}}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/emer.Path", IDName: "path", Doc: "Path defines the basic interface for a pathway which connects two layers.\nName is set automatically to: SendLay().Name() + \"To\" + RecvLay().Name()"}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/emer.Path", IDName: "path", Doc: "Path defines the basic interface for a pathway which connects two layers.\nName is set automatically to: SendLay().Name() + \"To\" + RecvLay().Name()", Methods: []types.Method{{Name: "Init", Doc: "Init MUST be called to initialize the path's pointer to itself as an emer.Path\nwhich enables the proper interface methods to be called.", Args: []string{"path"}}, {Name: "SendLay", Doc: "SendLay returns the sending layer for this pathway", Returns: []string{"Layer"}}, {Name: "RecvLay", Doc: "RecvLay returns the receiving layer for this pathway", Returns: []string{"Layer"}}, {Name: "Pattern", Doc: "Pattern returns the pattern of connectivity for interconnecting the layers", Returns: []string{"Pattern"}}, {Name: "SetPattern", Doc: "SetPattern sets the pattern of connectivity for interconnecting the layers.\nReturns Path so it can be chained to set other properties too", Args: []string{"pat"}, Returns: []string{"Path"}}, {Name: "Type", Doc: "Type returns the functional type of pathway according to PathType (extensible in\nmore specialized algorithms)", Returns: []string{"PathType"}}, {Name: "SetType", Doc: "SetType sets the functional type of pathway according to PathType\nReturns Path so it can be chained to set other properties too", Args: []string{"typ"}, Returns: []string{"Path"}}, {Name: "PathTypeName", Doc: "PathTypeName returns the string rep of functional type of pathway\naccording to PathType (extensible in more specialized algorithms, by\nredefining this method as needed).", Returns: []string{"string"}}, {Name: "AddClass", Doc: "AddClass adds a CSS-style class name(s) for this path,\nensuring that it is not a duplicate, and properly space separated.\nReturns Path so it can be chained to set other properties too", Args: []string{"cls"}, Returns: []string{"Path"}}, {Name: "Label", Doc: "Label satisfies the core.Labeler interface for getting the name of objects generically", Returns: []string{"string"}}, {Name: "IsOff", Doc: "IsOff returns true if pathway or either send or recv layer has been turned Off.\nUseful for experimentation", Returns: []string{"bool"}}, {Name: "SetOff", Doc: "SetOff sets the pathway Off status (i.e., lesioned). Careful: Layer.SetOff(true) will\nreactivate that layer's pathways, so pathway-level lesioning should always be called\nafter layer-level lesioning.", Args: []string{"off"}}, {Name: "SynVarNames", Doc: "SynVarNames returns the names of all the variables on the synapse\nThis is typically a global list so do not modify!", Returns: []string{"[]string"}}, {Name: "SynVarProps", Doc: "SynVarProps returns a map of synapse variable properties, with the key being the\nname of the variable, and the value gives a space-separated list of\ngo-tag-style properties for that variable.\nThe NetView recognizes the following properties:\nrange:\"##\" = +- range around 0 for default display scaling\nmin:\"##\" max:\"##\" = min, max display range\nauto-scale:\"+\" or \"-\" = use automatic scaling instead of fixed range or not.\nzeroctr:\"+\" or \"-\" = control whether zero-centering is used\nNote: this is a global list so do not modify!", Returns: []string{"map[string]string"}}, {Name: "SynIndex", Doc: "SynIndex returns the index of the synapse between given send, recv unit indexes\n(1D, flat indexes). Returns -1 if synapse not found between these two neurons.\nThis requires searching within connections for receiving unit (a bit slow).", Args: []string{"sidx", "ridx"}, Returns: []string{"int"}}, {Name: "SynVarIndex", Doc: "SynVarIndex returns the index of given variable within the synapse,\naccording to *this path's* SynVarNames() list (using a map to lookup index),\nor -1 and error message if not found.", Args: []string{"varNm"}, Returns: []string{"int", "error"}}, {Name: "SynVarNum", Doc: "SynVarNum returns the number of synapse-level variables\nfor this paths. This is needed for extending indexes in derived types.", Returns: []string{"int"}}, {Name: "Syn1DNum", Doc: "Syn1DNum returns the number of synapses for this path as a 1D array.\nThis is the max idx for SynVal1D and the number of vals set by SynValues.", Returns: []string{"int"}}, {Name: "SynVal1D", Doc: "SynVal1D returns value of given variable index (from SynVarIndex) on given SynIndex.\nReturns NaN on invalid index.\nThis is the core synapse var access method used by other methods,\nso it is the only one that needs to be updated for derived layer types.", Args: []string{"varIndex", "synIndex"}, Returns: []string{"float32"}}, {Name: "SynValues", Doc: "SynValues sets values of given variable name for each synapse, using the natural ordering\nof the synapses (sender based for Leabra),\ninto given float32 slice (only resized if not big enough).\nReturns error on invalid var name.", Args: []string{"vals", "varNm"}, Returns: []string{"error"}}, {Name: "SynValue", Doc: "SynVal returns value of given variable name on the synapse\nbetween given send, recv unit indexes (1D, flat indexes).\nReturns math32.NaN() for access errors.", Args: []string{"varNm", "sidx", "ridx"}, Returns: []string{"float32"}}, {Name: "SetSynValue", Doc: "SetSynVal sets value of given variable name on the synapse\nbetween given send, recv unit indexes (1D, flat indexes).\nTypically only supports base synapse variables and is not extended\nfor derived types.\nReturns error for access errors.", Args: []string{"varNm", "sidx", "ridx", "val"}, Returns: []string{"error"}}, {Name: "Defaults", Doc: "Defaults sets default parameter values for all Path parameters"}, {Name: "UpdateParams", Doc: "UpdateParams() updates parameter values for all Path parameters,\nbased on any other params that might have changed."}, {Name: "ApplyParams", Doc: "ApplyParams applies given parameter style Sheet to this pathway.\nCalls UpdateParams if anything set to ensure derived parameters are all updated.\nIf setMsg is true, then a message is printed to confirm each parameter that is set.\nit always prints a message if a parameter fails to be set.\nreturns true if any params were set, and error if there were any errors.", Args: []string{"pars", "setMsg"}, Returns: []string{"bool", "error"}}, {Name: "SetParam", Doc: "SetParam sets parameter at given path to given value.\nreturns error if path not found or value cannot be set.", Args: []string{"path", "val"}, Returns: []string{"error"}}, {Name: "NonDefaultParams", Doc: "NonDefaultParams returns a listing of all parameters in the Projection that\nare not at their default values -- useful for setting param styles etc.", Returns: []string{"string"}}, {Name: "AllParams", Doc: "AllParams returns a listing of all parameters in the Projection", Returns: []string{"string"}}, {Name: "WriteWtsJSON", Doc: "WriteWtsJSON writes the weights from this pathway from the receiver-side perspective\nin a JSON text format. We build in the indentation logic to make it much faster and\nmore efficient.", Args: []string{"w", "depth"}}, {Name: "ReadWtsJSON", Doc: "ReadWtsJSON reads the weights from this pathway from the receiver-side perspective\nin a JSON text format. This is for a set of weights that were saved *for one path only*\nand is not used for the network-level ReadWtsJSON, which reads into a separate\nstructure -- see SetWts method.", Args: []string{"r"}, Returns: []string{"error"}}, {Name: "SetWts", Doc: "SetWts sets the weights for this pathway from weights.Path decoded values", Args: []string{"pw"}, Returns: []string{"error"}}, {Name: "Build", Doc: "Build constructs the full connectivity among the layers as specified in this pathway.", Returns: []string{"error"}}}}) var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/emer.Paths", IDName: "paths", Doc: "Paths is a slice of pathways"}) diff --git a/env/typegen.go b/env/typegen.go index 207ce415..4c3e1893 100644 --- a/env/typegen.go +++ b/env/typegen.go @@ -20,9 +20,9 @@ var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/env.Element var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/env.Elements", IDName: "elements", Doc: "Elements is a list of Element info"}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/env.Env", IDName: "env", Doc: "Env defines an interface for environments, which determine the nature and\nsequence of States that can be used as inputs to a model, and the Env\nalso can accept Action responses from the model that affect state evolution.\n\nThe Env encapsulates all of the counter management logic to advance\nthe temporal state of the environment, using TimeScales standard\nintervals.\n\nState is comprised of one or more Elements, each of which consists of an\ntensor.Tensor chunk of values that can be obtained by the model.\nLikewise, Actions can also have Elements. The Step method is the main\ninterface for advancing the Env state. Counters should be queried\nafter calling Step to see if any relevant values have changed, to trigger\nfunctions in the model (e.g., logging of prior statistics, etc).\n\nTypically each specific implementation of this Env interface will have\nmultiple parameters etc that can be modified to control env behavior --\nall of this is paradigm-specific and outside the scope of this basic interface.", Directives: []types.Directive{{Tool: "go", Directive: "generate", Args: []string{"core", "generate", "-add-types"}}}}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/env.Env", IDName: "env", Doc: "Env defines an interface for environments, which determine the nature and\nsequence of States that can be used as inputs to a model, and the Env\nalso can accept Action responses from the model that affect state evolution.\n\nThe Env encapsulates all of the counter management logic to advance\nthe temporal state of the environment, using TimeScales standard\nintervals.\n\nState is comprised of one or more Elements, each of which consists of an\ntensor.Tensor chunk of values that can be obtained by the model.\nLikewise, Actions can also have Elements. The Step method is the main\ninterface for advancing the Env state. Counters should be queried\nafter calling Step to see if any relevant values have changed, to trigger\nfunctions in the model (e.g., logging of prior statistics, etc).\n\nTypically each specific implementation of this Env interface will have\nmultiple parameters etc that can be modified to control env behavior --\nall of this is paradigm-specific and outside the scope of this basic interface.", Directives: []types.Directive{{Tool: "go", Directive: "generate", Args: []string{"core", "generate", "-add-types"}}}, Methods: []types.Method{{Name: "Name", Doc: "Name returns a name for this environment, which can be useful\nfor selecting from a list of options etc.", Returns: []string{"string"}}, {Name: "Desc", Doc: "Desc returns an (optional) brief description of this particular\nenvironment", Returns: []string{"string"}}, {Name: "Validate", Doc: "Validate checks if the various specific parameters for this\nEnv have been properly set -- if not, error message(s) will\nbe returned. If everything is OK, nil is returned, in which\ncase calls to Counters(), States(), and Actions() should all\nreturn valid data. It is essential that a model *always* check\nthis as a first step, because the Env will not generally check\nfor errors on any subsequent calls (for greater efficiency\nand simplicity) and this call can also establish certain general\ninitialization settings that are not run-specific and thus make\nsense to do once at this point, not every time during Init().", Returns: []string{"error"}}, {Name: "Init", Doc: "Init initializes the environment for a given run of the model.\nThe environment may not care about the run number, but may implement\ndifferent parameterizations for different runs (e.g., between-subject\nmanipulations). In general the Env can expect that the model will likely\nhave established a different random seed per run, prior to calling this\nmethod, and that may be sufficient to enable different run-level behavior.\nAll other initialization / updating beyond this outer-most Run level must\nbe managed internally by the Env itself, and the model can query the\nCounter state information to determine when things have updated at different\ntime scales. See Step() for important info about state of env after Init\nbut prior to first Step() call.", Args: []string{"run"}}, {Name: "Step", Doc: "Step generates the next step of environment state.\nThis is the main API for how the model interacts with the environment --\nthe env should update all other levels of state internally over\nrepeated calls to the Step method.\nIf there are no further inputs available, it returns false (most envs\ntypically only return true and just continue running as long as needed).\n\nThe Env thus always reflects the *current* state of things, and this\ncall increments that current state, such that subsequent calls to\nState(), Counter() etc will return this current state.\nThis implies that the state just after Init and prior to first Step\ncall should be an *initialized* state that then allows the first Step\ncall to establish the proper *first* state. Typically this means that\none or more counters will be set to -1 during Init and then get incremented\nto 0 on the first Step call.", Returns: []string{"bool"}}, {Name: "Counter", Doc: "Counter(scale TimeScales) returns current counter state for given time scale,\nthe immediate previous counter state, and whether that time scale changed\nduring the last Step() function call (this may be true even if cur == prv, if\nthe Max = 1). Use the Ctr struct for each counter, which manages all of this.\nSee external Counter* methods for Python-safe single-return-value versions.", Args: []string{"scale"}, Returns: []string{"cur", "prv", "changed"}}, {Name: "State", Doc: "State returns the given element's worth of tensor data from the environment\nbased on the current state of the env, as a function of having called Step().\nIf no output is available on that element, then nil is returned.\nThe returned tensor must be treated as read-only as it likely points to original\nsource data -- please make a copy before modifying (e.g., Clone() methdod)", Args: []string{"element"}, Returns: []string{"Tensor"}}, {Name: "Action", Doc: "Action sends tensor data about e.g., responses from model back to act\non the environment and influence its subsequent evolution.\nThe nature and timing of this input is paradigm dependent.", Args: []string{"element", "input"}}}}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/env.EnvDesc", IDName: "env-desc", Doc: "EnvDesc is an interface that defines methods that describe an Env.\nThese are optional for basic Env, but in cases where an Env\nshould be fully self-describing, these methods can be implemented."}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/env.EnvDesc", IDName: "env-desc", Doc: "EnvDesc is an interface that defines methods that describe an Env.\nThese are optional for basic Env, but in cases where an Env\nshould be fully self-describing, these methods can be implemented.", Methods: []types.Method{{Name: "Counters", Doc: "Counters returns []TimeScales list of counters supported by this env.\nThese should be consistent within a paradigm and most models\nwill just expect particular sets of counters, but this can be\nuseful for sanity checking that a suitable env has been selected.\nSee SchemaFromScales function that takes this list of time\nscales and returns an table.Schema for Table columns to record\nthese counters in a log.", Returns: []string{"TimeScales"}}, {Name: "States", Doc: "States returns a list of Elements of tensor outputs that this env\ngenerates, specifying the unique Name and Shape of the data.\nThis information can be derived directly from an table.Schema\nand used for configuring model input / output pathways to fit\nwith those provided by the environment. Depending on the\nenv paradigm, all elements may not be always available at every\npoint in time e.g., an env might alternate between Action and Reward\nelements. This may return nil if Env has not been properly\nconfigured.", Returns: []string{"Elements"}}, {Name: "Actions", Doc: "Actions returns a list of elements of tensor inputs that this env\naccepts, specifying the unique Name and Shape of the data.\nSpecific paradigms of envs can establish the timing and function\nof these inputs, and how they then affect subsequent outputs\ne.g., if the model is required to make a particular choice\nresponse and then it can receive a reward or not contingent\non that choice.", Returns: []string{"Elements"}}}}) var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/env.Envs", IDName: "envs", Doc: "Envs is a map of environments organized according\nto the evaluation mode string (recommended key value)"}) diff --git a/params/typegen.go b/params/typegen.go index 12545bb9..d9e71bea 100644 --- a/params/typegen.go +++ b/params/typegen.go @@ -10,7 +10,7 @@ var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/params.Flex var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/params.Flex", IDName: "flex", Doc: "Flex supports arbitrary named parameter values that can be set\nby a Set of parameters, as a map of any objects.\nFirst initialize the map with set of names and a type to create\nblank values, then apply the Set to it."}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/params.History", IDName: "history", Doc: "The params.History interface records history of parameters applied\nto a given object."}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/params.History", IDName: "history", Doc: "The params.History interface records history of parameters applied\nto a given object.", Methods: []types.Method{{Name: "ParamsHistoryReset", Doc: "ParamsHistoryReset resets parameter application history"}, {Name: "ParamsApplied", Doc: "ParamsApplied is called when a parameter is successfully applied for given selector", Args: []string{"sel"}}}}) var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/params.HistoryImpl", IDName: "history-impl", Doc: "HistoryImpl implements the History interface. Implementing object can\njust pass calls to a HistoryImpl field."}) @@ -32,8 +32,8 @@ var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/params.Sets var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/params.SearchValues", IDName: "search-values", Doc: "SearchValues is a list of parameter values to search for one parameter\non a given object (specified by Name), for float-valued params.", Fields: []types.Field{{Name: "Name", Doc: "name of object with the parameter"}, {Name: "Type", Doc: "type of object with the parameter. This is a Base type name (e.g., Layer, Path),\nthat is at the start of the path in Network params."}, {Name: "Path", Doc: "path to the parameter within the object"}, {Name: "Start", Doc: "starting value, e.g., for restoring after searching\nbefore moving on to another parameter, for grid search."}, {Name: "Values", Doc: "values of the parameter to search"}}}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/params.Styler", IDName: "styler", Doc: "The params.Styler interface exposes TypeName, Class, and Name methods\nthat allow the params.Sel CSS-style selection specifier to determine\nwhether a given parameter applies.\nAdding Set versions of Name and Class methods is a good idea but not\nneeded for this interface, so they are not included here."}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/params.Styler", IDName: "styler", Doc: "The params.Styler interface exposes TypeName, Class, and Name methods\nthat allow the params.Sel CSS-style selection specifier to determine\nwhether a given parameter applies.\nAdding Set versions of Name and Class methods is a good idea but not\nneeded for this interface, so they are not included here.", Methods: []types.Method{{Name: "TypeName", Doc: "TypeName returns the name of this type. CSS Sel selector with no prefix\noperates on type name. This type is used *in addition* to the actual\nGo type name of the object, and is a kind of type-category (e.g., Layer\nor Path in emergent network objects)", Returns: []string{"string"}}, {Name: "Class", Doc: "Class returns the space-separated list of class selectors (tags).\nParameters with a . prefix target class tags.\nDo NOT include the. in the Class tags on Styler objects however\n-- those are only in the Sel selector on the params.Sel.", Returns: []string{"string"}}, {Name: "Name", Doc: "Name returns the name of this object.\nParameters with a # prefix target object names, which are typically\nunique. Note, do not include the # prefix in the Styler name.", Returns: []string{"string"}}}}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/params.StylerObj", IDName: "styler-obj", Doc: "The params.StylerObj interface extends Styler to include an arbitary\nfunction to access the underlying object type."}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/params.StylerObj", IDName: "styler-obj", Doc: "The params.StylerObj interface extends Styler to include an arbitary\nfunction to access the underlying object type.", Methods: []types.Method{{Name: "Object", Doc: "Object returns the object that will have its field values set by\nthe params specifications.", Returns: []string{"any"}}}}) var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/params.Tweaks", IDName: "tweaks", Doc: "Tweaks holds parameter tweak values associated with one parameter selector.\nHas all the object values affected for a given parameter within one\nselector, that has a tweak hyperparameter set.", Fields: []types.Field{{Name: "Param", Doc: "the parameter path for this param"}, {Name: "Sel", Doc: "the param selector that set the specific value upon which tweak is based"}, {Name: "Search", Doc: "the search values for all objects covered by this selector"}}}) diff --git a/paths/typegen.go b/paths/typegen.go index 974fb07c..bbfd794d 100644 --- a/paths/typegen.go +++ b/paths/typegen.go @@ -12,7 +12,7 @@ var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/paths.Full" var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/paths.OneToOne", IDName: "one-to-one", Doc: "OneToOne implements point-to-point one-to-one pattern of connectivity between two layers", Fields: []types.Field{{Name: "NCons", Doc: "number of recv connections to make (0 for entire size of recv layer)"}, {Name: "SendStart", Doc: "starting unit index for sending connections"}, {Name: "RecvStart", Doc: "starting unit index for recv connections"}}}) -var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/paths.Pattern", IDName: "pattern", Doc: "Pattern defines a pattern of connectivity between two layers.\nThe pattern is stored efficiently using a bitslice tensor of binary values indicating\npresence or absence of connection between two items.\nA receiver-based organization is generally assumed but connectivity can go either way."}) +var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/paths.Pattern", IDName: "pattern", Doc: "Pattern defines a pattern of connectivity between two layers.\nThe pattern is stored efficiently using a bitslice tensor of binary values indicating\npresence or absence of connection between two items.\nA receiver-based organization is generally assumed but connectivity can go either way.", Methods: []types.Method{{Name: "Name", Doc: "Name returns the name of the pattern -- i.e., the \"type\" name of the actual pattern generatop", Returns: []string{"string"}}, {Name: "Connect", Doc: "Connect connects layers with the given shapes, returning the pattern of connectivity\nas a bits tensor with shape = recv + send shapes, using row-major ordering with outer-most\nindexes first (i.e., for each recv unit, there is a full inner-level of sender bits).\nThe number of connections for each recv and each send unit are also returned in\nrecvn and send tensors, each the shape of send and recv respectively.\nThe same flag should be set to true if the send and recv layers are the same (i.e., a self-connection)\noften there are some different options for such connections.", Args: []string{"send", "recv", "same"}, Returns: []string{"sendn", "recvn", "cons"}}}}) var _ = types.AddType(&types.Type{Name: "github.com/emer/emergent/v2/paths.PoolOneToOne", IDName: "pool-one-to-one", Doc: "PoolOneToOne implements one-to-one connectivity between pools within layers.\nPools are the outer-most two dimensions of a 4D layer shape.\nIf either layer does not have pools, then if the number of individual\nunits matches the number of pools in the other layer, those are connected one-to-one\notherwise each pool connects to the entire set of other units.\nIf neither is 4D, then it is equivalent to OneToOne.", Fields: []types.Field{{Name: "NPools", Doc: "number of recv pools to connect (0 for entire number of pools in recv layer)"}, {Name: "SendStart", Doc: "starting pool index for sending connections"}, {Name: "RecvStart", Doc: "starting pool index for recv connections"}}})