robustx.lib.intabs package

Submodules

robustx.lib.intabs.IntervalAbstractionPyTorch module

class robustx.lib.intabs.IntervalAbstractionPyTorch.IntervalAbstractionPytorch(model, delta, bias_delta=None)[source]

Bases: object

Converts a provided PyTorch neural network into a representation of an Interval Neural Network

Attributes / Properties

bias_intervals: Dict[str, (int, int)]

The intervals for each of the biases in the NN with key ‘bias_into_l{layer_idx}_n{dest_idx}’, where input layer has a layer_idx of 0

weight_intervals: Dict[str, (int, int)]

The intervals for each of the weights in the NN with key ‘weight_into_l{layer_idx}_n{dest_idx}’, where input layer has a layer_idx of 0

layers: list[int]

Stores the number of nodes in each layer in a list

model: BaseModel

The original model

delta: int

The perturbation to each weight in the Neural Network

bias_delta: int

The perturbation to each bias in the Neural Network


evaluate() int:

Returns the proportion of CEs which are robust for the given parameters

-------
create_weights_and_bias_dictionary()[source]

Generates the intervals for each weight and bias in the Neural Network

robustx.lib.intabs.WeightBiasDictionary module

robustx.lib.intabs.WeightBiasDictionary.create_weights_and_bias_dictionary(model)[source]

Util function for extracting the dictionary for model parameters. layer 0 is input layer

Module contents