brainstate.nn.init_maybe_prefetch

brainstate.nn.init_maybe_prefetch#

brainstate.nn.init_maybe_prefetch(target, *args, **kwargs)[source]#

Initialize a prefetch target if needed, based on its type.

This function ensures that prefetch references are properly initialized and ready to use. It handles different types of prefetch objects by performing the appropriate initialization action: - For Prefetch objects: retrieves the referenced item - For PrefetchDelay objects: retrieves the delay handler - For PrefetchDelayAt objects: registers the specified delay

Parameters:
  • target (Any) – The prefetch target to initialize.

  • *args (Any) – Additional positional arguments (unused).

  • **kwargs (Any) – Additional keyword arguments (unused).

Returns:

This function performs initialization side effects only.

Return type:

None

Notes

This function is typically called internally when prefetched references are used to ensure they are properly set up before access.