afnio.cognitive.parameter
afnio.cognitive.parameter.Parameter
Bases: Variable
A kind of Variable that is to be considered a module parameter.
Parameters are Variable subclasses, that have a very special
property when used with Modules - when assigned
as an attribute to a Module, they are automatically added to the list of its
parameters, and will appear e.g. in
parameters() iterator.
Assigning a Variable doesn't have such effect. This is because one might want to
cache some temporary state, like a piece of context memory for
ChatCompletion, in
the agent. If there was no such class as Parameter, these temporaries would
get registered too.
Attributes:
| Name | Type | Description |
|---|---|---|
data |
str | int | float | list[str | int | float] | None
|
The raw data, which can be a scalar string or number, or a sequence of such scalars. |
role |
str
|
A specific description of the role of the parameter in the agent that provides context to the optimizer. |
requires_grad |
bool
|
Whether to track operations for automatic differentiation and compute gradients. |
Source code in afnio/cognitive/parameter.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
__init__(data=None, role=None, requires_grad=True)
Initializes a Parameter instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
str | int | float | list[str | int | float] | None
|
The raw data for the parameter, which can be a scalar string or number, or a sequence of such scalars. |
None
|
role
|
str
|
A specific description of the role of the parameter in the agent that
provides context to the |
None
|
requires_grad
|
bool
|
A boolean indicating whether to compute gradients for this
parameter during backpropagation. Defaults to |
True
|
Source code in afnio/cognitive/parameter.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |