NeuroTorch

neurotorch.init package

Module contents

neurotorch.init.dale_(tensor: Tensor, inh_ratio: float = 0.5, rho: float = 0.99, inh_first: bool = True, seed: int | None = None) Tensor

Initialize a tensor with Dale’s law. As default it is half excitatory, half inhibitory. The connections in the tensor are considered as i (row) -> j (col).

Parameters:
  • tensor (torch.Tensor) – tensor to initialize. This tensor will be modified inplace.

  • inh_ratio (float) – ratio of inhibitory connections. Must be between 0 and 1. Default is 0.5.

  • rho (float) – The connectivity ratio. Must be between 0 and 1. If rho = 1, the tensor will be fully connected. Default is 0.99.

  • inh_first (bool) – If True, the inhibitory neurons will be in the first half of the tensor. If False, the neurons will be shuffled. Default is True.

  • seed (Optional[int]) – seed for the random number generator. If None, the seed is not set.

Returns:

The initialized tensor.

Return type:

torch.Tensor