brainpy.base.Function#

class brainpy.base.Function(f, nodes=None, dyn_vars=None, name=None)[source]#

The wrapper for Python functions.

Parameters
  • f (function) – The function to wrap.

  • nodes (optional, Base, sequence of Base, dict) – The nodes in the defined function f.

  • dyn_vars (optional, ndarray, sequence of ndarray, dict) – The dynamically changed variables.

  • name (optional, str) – The function name.

__init__(f, nodes=None, dyn_vars=None, name=None)[source]#

Methods

__init__(f[, nodes, dyn_vars, name])

load_states(filename[, verbose])

Load the model states.

nodes([method, level, include_self])

Collect all children nodes.

register_implicit_nodes(*nodes, **named_nodes)

register_implicit_vars(*variables, ...)

save_states(filename[, variables])

Save the model states.

train_vars([method, level, include_self])

The shortcut for retrieving all trainable variables.

unique_name([name, type_])

Get the unique name for this object.

vars([method, level, include_self])

Collect all variables in this node and the children nodes.

Attributes

name

Name of the model.