sax.nn.core module

sax.nn.core module#

SAX Neural Network Core Utils

preprocess(*params)[source]#

preprocess parameters

> Note: (1) all arguments are first casted into the same shape. (2) then pairs

of arguments are divided into each other to create relative arguments. (3) all arguments are then stacked into one big tensor

Parameters:

params (ComplexArrayND) –

Return type:

ComplexArrayND

dense(weights, *params, x_norm=(0.0, 1.0), y_norm=(0.0, 1.0), preprocess=<function preprocess>, activation=<PjitFunction of <function leaky_relu>>)[source]#

simple dense neural network

Parameters:
  • weights (Dict[str, Array]) –

  • params (ComplexArrayND) –

  • x_norm (Tuple[float, float]) –

  • y_norm (Tuple[float, float]) –

  • preprocess (Callable) –

  • activation (Callable) –

Return type:

ComplexArrayND

generate_dense_weights(key, sizes, input_names=None, output_names=None, preprocess=<function preprocess>)[source]#

Generate the weights for a dense neural network

Parameters:
  • key (Union[int, Array]) –

  • sizes (Tuple[int, ...]) –

  • input_names (Optional[Tuple[str, ...]]) –

  • output_names (Optional[Tuple[str, ...]]) –

Return type:

Dict[str, ComplexArrayND]