This class stores all layers converted to torch in a module which can be used like the original model (but torch-based). In addition, it provides other functions that are useful for interpreting individual predictions or explaining the entire model. This model is part of the class Converter and is the core for all the necessary calculations in the methods provided in this package.
ConvertedModel(modules_list, dtype = "float")
A list of all accepted layers created by the 'Converter' class during initialization.
The data type for all the calculations and defined tensors. Use
either 'float'
for torch::torch_float or 'double'
for
torch::torch_double.
modules_list
A list of all accepted layers created by the 'Converter' class during initialization.
dtype
The datatype for all the calculations and defined
tensors. Either 'float'
for torch::torch_float or 'double'
for
torch::torch_double
forward()
The forward method of the whole model, i.e. it calculates the output
\(y=f(x)\) of a given input \(x\). In doing so, all intermediate
values are stored in the individual torch modules from modules_list
.
update_ref()
This method updates the stored intermediate values in each module from the
list modules_list
when the reference input x_ref
has changed.
set_dtype()
This method changes the data type for all the layers in modules_list
.
Use either 'float'
for torch::torch_float or 'double'
for
torch::torch_double.