Logging
svetlanna.debug_logging.set_debug_logging
Enable or disable debug logging for elements.
Logs information about element registration (parameters, buffers, submodules) and forward pass execution. This helps debug and trace data flow through the optical setup.
Parameters:
-
mode(bool) –Whether to enable debug logging.
-
type(Literal['logging', 'print'], default:'print') –Output method:
'print'usesprint(),'logging'writes to thesvetlanna.logginglogger at DEBUG level, by default'print'.
Raises:
-
ValueError–If
typeis not'logging'or'print'.
Examples:
Output:
Buffer of DiffractiveLayer was registered with name mask:
<class 'torch.Tensor'> shape=torch.Size([512, 512]), dtype=torch.float32, device=cpu
The forward method of DiffractiveLayer was computed
input 0: <class 'svetlanna.wavefront.Wavefront'> shape=torch.Size([512, 512]), dtype=torch.complex64, device=cpu
output 0: <class 'svetlanna.wavefront.Wavefront'> shape=torch.Size([512, 512]), dtype=torch.complex64, device=cpu