MCPcopy Create free account
hub / github.com/BindsNET/bindsnet / LocalConnection

Class LocalConnection

bindsnet/network/topology.py:1304–1484  ·  view source on GitHub ↗

Specifies a locally connected connection between one or two populations of neurons.

Source from the content-addressed store, hash-verified

1302
1303
1304class LocalConnection(AbstractConnection):
1305 # language=rst
1306 """
1307 Specifies a locally connected connection between one or two populations of neurons.
1308 """
1309
1310 def __init__(
1311 self,
1312 source: Nodes,
1313 target: Nodes,
1314 kernel_size: Union[int, Tuple[int, int]],
1315 stride: Union[int, Tuple[int, int]],
1316 n_filters: int,
1317 nu: Optional[Union[float, Sequence[float], Sequence[torch.Tensor]]] = None,
1318 reduction: Optional[callable] = None,
1319 weight_decay: float = 0.0,
1320 w_dtype: torch.dtype = torch.float32,
1321 **kwargs,
1322 ) -> None:
1323 # language=rst
1324 """
1325 Instantiates a ``LocalConnection2D`` object. Source population should have
1326 square size
1327
1328 Neurons in the post-synaptic population are ordered by receptive field; that is,
1329 if there are ``n_conv`` neurons in each post-synaptic patch, then the first
1330 ``n_conv`` neurons in the post-synaptic population correspond to the first
1331 receptive field, the second ``n_conv`` to the second receptive field, and so on.
1332
1333 :param source: A layer of nodes from which the connection originates.
1334 :param target: A layer of nodes to which the connection connects.
1335 :param kernel_size: Horizontal and vertical size of convolutional kernels.
1336 :param stride: Horizontal and vertical stride for convolution.
1337 :param n_filters: Number of locally connected filters per pre-synaptic region.
1338 :param nu: Learning rate for both pre- and post-synaptic events. It also
1339 accepts a pair of tensors to individualize learning rates of each neuron.
1340 In this case, their shape should be the same size as the connection weights.
1341 :param reduction: Method for reducing parameter updates along the minibatch
1342 dimension.
1343 :param weight_decay: Constant multiple to decay weights by on each iteration.
1344 :param w_dtype: Data type for :code:`w` tensor
1345
1346 Keyword arguments:
1347
1348 :param LearningRule update_rule: Modifies connection parameters according to
1349 some rule.
1350 :param torch.Tensor w: Strengths of synapses.
1351 :param torch.Tensor b: Target population bias.
1352 :param Union[float, torch.Tensor] wmin: Minimum allowed value(s) on the connection weights. Single value, or
1353 tensor of same size as w
1354 :param Union[float, torch.Tensor] wmax: Maximum allowed value(s) on the connection weights. Single value, or
1355 tensor of same size as w
1356 :param float norm: Total weight per target neuron normalization constant.
1357 :param Tuple[int, int] input_shape: Shape of input population if it's not
1358 ``[sqrt, sqrt]``.
1359 """
1360
1361 super().__init__(source, target, nu, reduction, weight_decay, **kwargs)

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected