nnopinf.operators.Operator#

class nnopinf.operators.Operator(*args, **kwargs)[source]#

Bases: Protocol

Protocol for operator class.

forward(inputs, return_jacobian=False)[source]#

Forward pass of operator

Parameters:
  • inputs (dict(str, np.array)) – Dictionary of input data in the form of arrays referenced by the variable name, i.e., inputs[‘x’] = np.ones(3)

  • return_jacobian (bool, optional) – If True, return the (approximate) Jacobian in addition to the output.

set_scalings(input_scaling, output_scaling)[source]#

Apply input and output scaling factors to the operator parameters.

Parameters:
  • input_scaling (dict) – Mapping from variable name to the corresponding feature-wise input scaling vector.

  • output_scaling (tensor-like) – Feature-wise scaling vector for the operator output.