TorchLogix Package
The main TorchLogix package provides the core functionality for differentiable logic gate neural networks.
Main Classes
Unified compiled logic network that handles convolutional, pooling, and linear layers. |
Package Contents
The main package for torchlogix.
- class torchlogix.CompiledLogicNet(model, input_shape, device='cpu', num_bits=64, cpu_compiler='gcc', verbose=False, use_bitpacking=True)[source]
Bases:
ModuleUnified compiled logic network that handles convolutional, pooling, and linear layers.
- __init__(model, input_shape, device='cpu', num_bits=64, cpu_compiler='gcc', verbose=False, use_bitpacking=True)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- compile(opt_level=1, save_lib_path=None, verbose=False)[source]
Compile the network to a shared library.
- forward(x, verbose=False)[source]
Forward pass through the compiled network.
- Return type:
IntTensor
- get_gate_code(var1, var2, gate_op)[source]
Generate C code for a logic gate operation.
- Return type:
- static load(save_lib_path, input_shape, num_classes=None, num_bits=64)[source]
Load a compiled network from a shared library.
Note: input_shape is required here since we’re loading a pre-compiled library without access to the original model structure for inference.
- training: bool