Parametric Function module
- class nnodely.layers.parametricfunction.ParamFun(param_fun: Callable, parameters_and_constants: list | dict | None = None, *, map_over_batch: bool = False)[source]
Represents a parametric function in the neural network model.
- Parameters:
param_fun (Callable) – The parametric function to be used.
constants (list or dict or None, optional) – A list or dictionary of constants to be used in the function. Default is None.
parameters_dimensions (list or dict or None, optional) – A list or dictionary specifying the dimensions of the parameters. Default is None.
parameters (list or dict or None, optional) – A list or dictionary of parameters to be used in the function. Default is None.
map_over_batch (bool, optional) – A boolean indicating whether to map the function over the batch dimension. Default is False.
- relation_name
The name of the relation.
- Type:
str
- param_fun
The parametric function to be used.
- Type:
Callable
- constants
A list or dictionary of constants to be used in the function.
- Type:
list or dict or None
- parameters_dimensions
A list or dictionary specifying the dimensions of the parameters.
- Type:
list or dict or None
- parameters
A list or dictionary of parameters to be used in the function.
- Type:
list or dict or None
- map_over_batch
A boolean indicating whether to map the function over the batch dimension.
- Type:
bool
- output_dimension
A dictionary containing the output dimensions of the function.
- Type:
dict
- json
A dictionary containing the configuration of the function.
- Type:
dict
Examples
input1 = Input('input1') input2 = Input('input2') def my_function(x, y, param1, const1): return param1 * x + const1 * y param_fun = ParamFun( my_function, constants={'const1': 1.0}, parameters_dimensions={'param1': 1} ) result = param_fun(input1, input2)
For more examples of how to use the parametric function module, please refer to the Parametric Function tutorial.