{ "cells": [ { "cell_type": "markdown", "id": "6c66e9b3", "metadata": {}, "source": [ "# Rockpool Parameter handling" ] }, { "cell_type": "raw", "id": "0ae425bf", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Modules in Rockpool use :py:class:`.Parameter` objects as initialisation arguments to represent trainable parameters of :py:class:`.Module` s, especially for the audograd backends for *Torch* and *Jax*. Non-trainable parameters are represented by :py:class:`.SimulationParameter` objects as initialisation arguments.\n", "\n", "By default, as many parameters as possible are trainable. If you pass a concrete initialisation value for a parameter, it will be initialised to that value (and will also reset to that value), but will nevertheless remain trainable.\n", "\n", "However, Rockpool also provides a convenient interface to disable training for a parameter, and fix it to a constant value. If you wrap a concrete initialisation value with the :py:func:`.Constant` call, it will force the corresponding parameter to become a constant, non-trainable :py:class:`.SimulationParameter` ." ] }, { "cell_type": "markdown", "id": "3c37625f", "metadata": {}, "source": [ "# Typehints in Rockpool" ] }, { "cell_type": "raw", "id": "59258cd0", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Rockpool provides a :py:mod:`~rockpool.typehints` package, providing convenient types to integrate into the Python type hinting system for your own code." ] }, { "cell_type": "raw", "id": "9c92857a", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "========================= =======================================\n", "P_int A Rockpool parameter wrapping an ``int``\n", "P_str A Rockpool parameter wrapping a ``str``\n", "P_float A Rockpool parameter wrapping a ``float``\n", "P_bool A Rockpool parameter wrapping a ``bool``\n", "P_tree A Rockpool parameter wrapping a nested Python iterable\n", "P_tensor A Rockpool parameter wrapping a torch ``Tensor``\n", "P_ndarray A Rockpool parameter wrapping a numpy ``ndarray``\n", "P_Callable A Rockpool parameter wrapping a callable object (e.g. a function)\n", "========================= =======================================\n", "\n", "========================= =======================================\n", "Tree A probably nested Python iterable, such as a ``tuple`` or nested ``dict``. The root of a tree.\n", "Leaf A leaf of a tree\n", "Value A value in a tree leaf\n", "Node A node (non-leaf) of a tree\n", "========================= =======================================\n", "\n", "========================= =======================================\n", "FloatVector A vector of ``float`` s (could be a scalar)\n", "IntVector A vector of ``int`` s (could be a scalar)\n", "========================= =======================================\n", "\n", "========================= =======================================\n", "JaxTreeDef A ``Jax`` tree definition object\n", "JaxRNGKey a ``Jax`` RNG key object\n", "========================= =======================================" ] } ], "metadata": { "kernelspec": { "display_name": "Python [conda env:py38_rp_test]", "language": "python", "name": "conda-env-py38_rp_test-py" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.0" } }, "nbformat": 4, "nbformat_minor": 5 }