-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
While debugging my own code, I noticed that CompiledLogicNet cannot be used to compile a model with just a single logic gate:
llkw = {
'connections': 'random',
'implementation': 'python',
'device': 'cpu'
}
model = torch.nn.Sequential(
torch.nn.Flatten(),
LogicLayer(in_dim=2, out_dim=1, **llkw),
GroupSum(1, tau=1)
)
compiled_model = CompiledLogicNet(
model=model,
num_bits=8,
cpu_compiler='gcc',
verbose=False
)
compiled_model.compile(
save_lib_path='minimal_example.so',
verbose=False
)
leads to the following error message:
error: use of undeclared identifier 'v0'
out[0] = (char) (~v0 | v1);
^
error: use of undeclared identifier 'v1'
out[0] = (char) (~v0 | v1);
^
This is because it produces the following c-code:
void logic_gate_net(char const *inp, char *out) {
out[0] = (char) (~v0 | v1);
}
where v0 and v1 are not declared.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels