-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Description
Is there a way instead of using random , that we use a tree like structure that is always a multiple powers of 2?
Sample
def forward(self, x):
# Input layer (8 inputs)
x = x.view(-1, 8)
# First layer (4 gates)
l1 = torch.stack([
self.gates[0](x[:,0], x[:,1]),
self.gates[1](x[:,2], x[:,3]),
self.gates[2](x[:,4], x[:,5]),
self.gates[3](x[:,6], x[:,7]),
], dim=1)
# Second layer (2 gates)
l2 = torch.stack([
self.gates[4](l1[:,0], l1[:,1]),
self.gates[5](l1[:,2], l1[:,3]),
], dim=1)
# Final output gate
out = self.gates[6](l2[:,0], l2[:,1])
return torch.sigmoid(out) # For binary classification
akin to this image:
where blue are the inputs, black are the diff logic gates, orange is the output
Metadata
Metadata
Assignees
Labels
No labels
