brainpy.nn.operations.fb_connect
brainpy.nn.operations.fb_connect#
- brainpy.nn.operations.fb_connect(senders, receivers, inplace=False, name=None, need_detect_cycle=True)[source]#
Create a feedback connection from
sender
node toreceiver
node. Feedbacks nodes will be called at runtime using data from the previous call.You can also perform this operation using the
<<
operator.Which means that a feedback connection is now created between node1 and node2. In other words, the forward function of node1 depends on the previous output of node2:
\[\mathrm{node1}(x_t) = \mathrm{node1}(x_t, \mathrm{node2}(x_{t - 1}))\]You can also use this function to define feedback:
node1 = fb_connect(node1, node2) # without copy (node1 is the same object throughout) node1 = fb_connect(node1, node2, inplace=True, name="n1_copy")
- Parameters
receivers (Node) – Node receiving feedback.
senders (GenericNode) – Node or Network sending feedback
inplace (bool, defaults to False) – If True, then the function returns a copy of node.
name (str, optional) – Name of the copy of node if inplace is True.
need_detect_cycle (bool) – Whether we need to detect cycles in the defined network.
- Returns
A network with feedback connections.
- Return type