functions
functions(name, network=None)Allows to access a global function declared with add_function() and use it from Python using arrays after compilation of the magic network.
The name of the function is not added to the global namespace to avoid overloading.
add_function("logistic(x) = 1. / (1. + exp(-x))")
magic_network().compile()
result = functions('logistic')([0., 1., 2., 3., 4.])Only lists or 1D Numpy arrays can be passed as arguments, not single values nor multidimensional arrays.
When passing several arguments, make sure they have the same size.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| name | str | name of the function. | required |